fix(front/auth/register form): don't show password register method if there is no UserNameComponent
fixes #44
This commit is contained in:
parent
6714e413a2
commit
3d960dccf3
@ -62,20 +62,22 @@
|
|||||||
<Form action={route('register') + queryStr} submitText="Register" submitIcon="check">
|
<Form action={route('register') + queryStr} submitText="Register" submitIcon="check">
|
||||||
<Field type="hidden" name="auth_method" value={registerUsingMagicLink ? 'magic_link': 'password'}/>
|
<Field type="hidden" name="auth_method" value={registerUsingMagicLink ? 'magic_link': 'password'}/>
|
||||||
|
|
||||||
{#if $locals.has_username}
|
{#if $locals.hasUsername}
|
||||||
<Field type="text" name={registerUsingMagicLink ? 'name' : 'identifier'} icon="user"
|
<Field type="text" name={registerUsingMagicLink ? 'name' : 'identifier'} icon="user"
|
||||||
placeholder="Choose your username"
|
placeholder="Choose your username"
|
||||||
pattern="[0-9a-z_-]+" required/>
|
pattern="[0-9a-z_-]+" required/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if registerUsingMagicLink}
|
{#if registerUsingMagicLink || !$locals.canRegisterWithPassword}
|
||||||
<Field type="email" name="identifier" icon="at-sign" placeholder="Your email address"
|
<Field type="email" name="identifier" icon="at-sign" placeholder="Your email address"
|
||||||
hint="You will receive a magic link in your mailbox. Click on the link from any device to register here."
|
hint="You will receive a magic link in your mailbox. Click on the link from any device to register here."
|
||||||
required/>
|
required/>
|
||||||
|
{#if $locals.canRegisterWithPassword}
|
||||||
<button on:click={() => registerUsingMagicLink=false} type="button">
|
<button on:click={() => registerUsingMagicLink=false} type="button">
|
||||||
<Icon name="key"/>
|
<Icon name="key"/>
|
||||||
Use password
|
Use password
|
||||||
</button>
|
</button>
|
||||||
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<Field type="password" name="password" icon="key" placeholder="Choose a password" required/>
|
<Field type="password" name="password" icon="key" placeholder="Choose a password" required/>
|
||||||
<Field type="password" name="password_confirmation" icon="key" placeholder="Confirm your password"
|
<Field type="password" name="password_confirmation" icon="key" placeholder="Confirm your password"
|
||||||
|
@ -46,8 +46,8 @@ export default class AuthController extends Controller {
|
|||||||
const hasUsername = userModelFactory.hasComponent(UserNameComponent);
|
const hasUsername = userModelFactory.hasComponent(UserNameComponent);
|
||||||
res.formatViewData('auth/auth', {
|
res.formatViewData('auth/auth', {
|
||||||
auth_methods: authGuard.getAuthMethodNames(),
|
auth_methods: authGuard.getAuthMethodNames(),
|
||||||
has_username: hasUsername,
|
hasUsername: hasUsername,
|
||||||
register_with_password: hasUsername && userModelFactory.hasComponent(UserPasswordComponent),
|
canRegisterWithPassword: hasUsername && userModelFactory.hasComponent(UserPasswordComponent),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user