mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-29 13:47:14 +00:00
style(web): format invitation flows
This commit is contained in:
@@ -92,7 +92,8 @@ export default function AcceptInvitationPage() {
|
|||||||
const [errorMessage, setErrorMessage] = useState('');
|
const [errorMessage, setErrorMessage] = useState('');
|
||||||
const [password, setPassword] = useState('');
|
const [password, setPassword] = useState('');
|
||||||
const [confirmPassword, setConfirmPassword] = useState('');
|
const [confirmPassword, setConfirmPassword] = useState('');
|
||||||
const [passwordRegistrationEnabled, setPasswordRegistrationEnabled] = useState(false);
|
const [passwordRegistrationEnabled, setPasswordRegistrationEnabled] =
|
||||||
|
useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleHashChange = () => setInvitationHash(window.location.hash);
|
const handleHashChange = () => setInvitationHash(window.location.hash);
|
||||||
@@ -109,9 +110,12 @@ export default function AcceptInvitationPage() {
|
|||||||
'error',
|
'error',
|
||||||
);
|
);
|
||||||
setToken(invitationToken);
|
setToken(invitationToken);
|
||||||
backendClient.getAccountInfo().then((info) => {
|
backendClient
|
||||||
|
.getAccountInfo()
|
||||||
|
.then((info) => {
|
||||||
setPasswordRegistrationEnabled(info.password_login_enabled !== false);
|
setPasswordRegistrationEnabled(info.password_login_enabled !== false);
|
||||||
}).catch(() => setPasswordRegistrationEnabled(false));
|
})
|
||||||
|
.catch(() => setPasswordRegistrationEnabled(false));
|
||||||
if (!invitationToken) {
|
if (!invitationToken) {
|
||||||
setErrorMessage(t('workspace.invitationMissing'));
|
setErrorMessage(t('workspace.invitationMissing'));
|
||||||
setStatus('error');
|
setStatus('error');
|
||||||
@@ -398,7 +402,10 @@ export default function AcceptInvitationPage() {
|
|||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<Button className="w-full" onClick={() => navigate('/login?invitation=1&auto=space')}>
|
<Button
|
||||||
|
className="w-full"
|
||||||
|
onClick={() => navigate('/login?invitation=1&auto=space')}
|
||||||
|
>
|
||||||
{t('common.loginWithSpace')}
|
{t('common.loginWithSpace')}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ export default function Register() {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [spaceLoading, setSpaceLoading] = useState(false);
|
const [spaceLoading, setSpaceLoading] = useState(false);
|
||||||
const [passwordRegistrationEnabled, setPasswordRegistrationEnabled] = useState(true);
|
const [passwordRegistrationEnabled, setPasswordRegistrationEnabled] =
|
||||||
|
useState(true);
|
||||||
|
|
||||||
const form = useForm<z.infer<ReturnType<typeof formSchema>>>({
|
const form = useForm<z.infer<ReturnType<typeof formSchema>>>({
|
||||||
resolver: zodResolver(formSchema(t)),
|
resolver: zodResolver(formSchema(t)),
|
||||||
@@ -58,7 +59,9 @@ export default function Register() {
|
|||||||
getIsInitialized();
|
getIsInitialized();
|
||||||
httpClient
|
httpClient
|
||||||
.getAccountInfo()
|
.getAccountInfo()
|
||||||
.then((info) => setPasswordRegistrationEnabled(info.password_login_enabled !== false))
|
.then((info) =>
|
||||||
|
setPasswordRegistrationEnabled(info.password_login_enabled !== false),
|
||||||
|
)
|
||||||
.catch(() => setPasswordRegistrationEnabled(true));
|
.catch(() => setPasswordRegistrationEnabled(true));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -179,7 +182,10 @@ export default function Register() {
|
|||||||
|
|
||||||
{/* Local Account Registration */}
|
{/* Local Account Registration */}
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-6">
|
<form
|
||||||
|
onSubmit={form.handleSubmit(onSubmit)}
|
||||||
|
className="space-y-6"
|
||||||
|
>
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="email"
|
name="email"
|
||||||
|
|||||||
Reference in New Issue
Block a user