fix(front/auth/login form): don't show password login method if there is not UserPasswordComponent
This commit is contained in:
parent
3d960dccf3
commit
e19a627eb5
@ -34,17 +34,19 @@
|
|||||||
hint={loginUsingMagicLink ? 'You will receive a magic link in your mailbox. Click on the link from any device to authenticate here.' : ''}
|
hint={loginUsingMagicLink ? 'You will receive a magic link in your mailbox. Click on the link from any device to authenticate here.' : ''}
|
||||||
placeholder="Your email address or username" required/>
|
placeholder="Your email address or username" required/>
|
||||||
|
|
||||||
{#if !loginUsingMagicLink}
|
{#if $locals.hasPassword}
|
||||||
|
{#if loginUsingMagicLink}
|
||||||
|
<button on:click={() => loginUsingMagicLink=false} type="button">
|
||||||
|
<Icon name="key"/>
|
||||||
|
Use password
|
||||||
|
</button>
|
||||||
|
{:else}
|
||||||
<Field type="password" name="password" placeholder="Your password" icon="key" required/>
|
<Field type="password" name="password" placeholder="Your password" icon="key" required/>
|
||||||
<button on:click={() => loginUsingMagicLink=true} type="button">
|
<button on:click={() => loginUsingMagicLink=true} type="button">
|
||||||
<Icon name="mail"/>
|
<Icon name="mail"/>
|
||||||
Use magic link
|
Use magic link
|
||||||
</button>
|
</button>
|
||||||
{:else}
|
{/if}
|
||||||
<button on:click={() => loginUsingMagicLink=false} type="button">
|
|
||||||
<Icon name="key"/>
|
|
||||||
Use password
|
|
||||||
</button>
|
|
||||||
{/if}
|
{/if}
|
||||||
<Field type="checkbox" name="persist_session" icon="clock"
|
<Field type="checkbox" name="persist_session" icon="clock"
|
||||||
placeholder="Stay logged in on this computer."/>
|
placeholder="Stay logged in on this computer."/>
|
||||||
|
@ -44,10 +44,12 @@ export default class AuthController extends Controller {
|
|||||||
|
|
||||||
const userModelFactory = ModelFactory.get(User);
|
const userModelFactory = ModelFactory.get(User);
|
||||||
const hasUsername = userModelFactory.hasComponent(UserNameComponent);
|
const hasUsername = userModelFactory.hasComponent(UserNameComponent);
|
||||||
|
const hasPassword = userModelFactory.hasComponent(UserPasswordComponent);
|
||||||
res.formatViewData('auth/auth', {
|
res.formatViewData('auth/auth', {
|
||||||
auth_methods: authGuard.getAuthMethodNames(),
|
auth_methods: authGuard.getAuthMethodNames(),
|
||||||
hasUsername: hasUsername,
|
hasUsername: hasUsername,
|
||||||
canRegisterWithPassword: hasUsername && userModelFactory.hasComponent(UserPasswordComponent),
|
hasPassword: hasPassword,
|
||||||
|
canRegisterWithPassword: hasUsername && hasPassword,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user