add a check to each auth context to mark if it supports persisting the login
This commit is contained in:
@@ -2,6 +2,7 @@ import { LoginRequestModel, IUmbAuthContext, LoginResponse } from './types.js';
|
||||
|
||||
export class UmbAuthLegacyContext implements IUmbAuthContext {
|
||||
readonly #AUTH_URL = '/umbraco/backoffice/umbracoapi/authentication/postlogin';
|
||||
readonly supportsPersistLogin = true;
|
||||
|
||||
login(data: LoginRequestModel): Promise<LoginResponse> {
|
||||
throw new Error('Method not implemented.');
|
||||
|
||||
@@ -3,6 +3,7 @@ import { LoginRequestModel, IUmbAuthContext } from './types.js';
|
||||
|
||||
export class UmbAuthContext implements IUmbAuthContext {
|
||||
readonly #AUTH_URL = '/umbraco/management/api/v1/security/back-office';
|
||||
readonly supportsPersistLogin = false;
|
||||
|
||||
#authRepository = new UmbAuthRepository(this.#AUTH_URL);
|
||||
|
||||
|
||||
@@ -105,9 +105,11 @@ export default class UmbLoginElement extends LitElement {
|
||||
required-message="Password is required"></uui-input-password>
|
||||
</uui-form-layout-item>
|
||||
|
||||
<uui-form-layout-item>
|
||||
<uui-checkbox name="persist" label="Remember me">Remember me</uui-checkbox>
|
||||
</uui-form-layout-item>
|
||||
${this.#authContext.supportsPersistLogin
|
||||
? html`<uui-form-layout-item>
|
||||
<uui-checkbox name="persist" label="Remember me">Remember me</uui-checkbox>
|
||||
</uui-form-layout-item>`
|
||||
: nothing}
|
||||
|
||||
<uui-form-layout-item>${this.#renderErrorMessage()}</uui-form-layout-item>
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ export type LoginRequestModel = {
|
||||
|
||||
export interface IUmbAuthContext {
|
||||
login(data: LoginRequestModel): Promise<LoginResponse>;
|
||||
supportsPersistLogin: boolean;
|
||||
}
|
||||
|
||||
export type LoginResponse = {
|
||||
|
||||
Reference in New Issue
Block a user