fix: hide Create new account button when signup is disabled

When is_user_creation_disabled is true in the /resource API response,
hide the 'Create new account' button on the login page entirely instead
of showing it and blocking with an error after the form is filled.

Fixes: donetick/donetick#602
This commit is contained in:
vi-ku
2026-03-27 20:35:13 +05:30
parent 3c29d4a19f
commit 56c97001fa

View File

@@ -771,17 +771,19 @@ const LoginView = () => {
</Button>
)}
<Button
onClick={() => {
Navigate('/signup')
}}
fullWidth
variant='soft'
size='lg'
// sx={{ mt: 3, mb: 2 }}
>
Create new account
</Button>
{!resource?.is_user_creation_disabled && (
<Button
onClick={() => {
Navigate('/signup')
}}
fullWidth
variant='soft'
size='lg'
// sx={{ mt: 3, mb: 2 }}
>
Create new account
</Button>
)}
<Box
sx={{ display: 'flex', justifyContent: 'center', gap: 2, mt: 2 }}