web/admin: fix errors in user profile when non-superuser

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-04-16 17:24:58 +02:00
parent 33a8cea007
commit e32070ddeb
5 changed files with 88 additions and 85 deletions

View File

@ -280,7 +280,7 @@ msgid "Authentication flow"
msgstr "Authentication flow" msgstr "Authentication flow"
#: src/flows/stages/authenticator_validate/AuthenticatorValidateStage.ts:63 #: src/flows/stages/authenticator_validate/AuthenticatorValidateStage.ts:63
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:29 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:33
msgid "Authenticator" msgid "Authenticator"
msgstr "Authenticator" msgstr "Authenticator"
@ -588,7 +588,7 @@ msgstr "Configuration"
msgid "Configuration flow" msgid "Configuration flow"
msgstr "Configuration flow" msgstr "Configuration flow"
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:103 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:106
msgid "Configure WebAuthn" msgid "Configure WebAuthn"
msgstr "Configure WebAuthn" msgstr "Configure WebAuthn"
@ -608,11 +608,11 @@ msgstr "Configure settings relevant to your user profile."
msgid "Configure what data should be used as unique User Identifier. For most cases, the default should be fine." msgid "Configure what data should be used as unique User Identifier. For most cases, the default should be fine."
msgstr "Configure what data should be used as unique User Identifier. For most cases, the default should be fine." msgstr "Configure what data should be used as unique User Identifier. For most cases, the default should be fine."
#: src/pages/user-settings/settings/SourceSettingsOAuth.ts:47 #: src/pages/user-settings/settings/SourceSettingsOAuth.ts:43
msgid "Connect" msgid "Connect"
msgstr "Connect" msgstr "Connect"
#: src/pages/user-settings/settings/SourceSettingsOAuth.ts:34 #: src/pages/user-settings/settings/SourceSettingsOAuth.ts:30
msgid "Connected." msgid "Connected."
msgstr "Connected." msgstr "Connected."
@ -832,7 +832,7 @@ msgstr "Create {0}"
msgid "Created by" msgid "Created by"
msgstr "Created by" msgstr "Created by"
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:86 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:90
msgid "Created {0}" msgid "Created {0}"
msgstr "Created {0}" msgstr "Created {0}"
@ -884,7 +884,7 @@ msgstr "Define how notifications are sent to users, like Email or Webhook."
#: src/pages/stages/invitation/InvitationListPage.ts:68 #: src/pages/stages/invitation/InvitationListPage.ts:68
#: src/pages/stages/prompt/PromptListPage.ts:87 #: src/pages/stages/prompt/PromptListPage.ts:87
#: src/pages/tokens/TokenListPage.ts:68 #: src/pages/tokens/TokenListPage.ts:68
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:36 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:40
#: src/pages/user-settings/tokens/UserTokenList.ts:125 #: src/pages/user-settings/tokens/UserTokenList.ts:125
#: src/pages/users/UserListPage.ts:115 #: src/pages/users/UserListPage.ts:115
msgid "Delete" msgid "Delete"
@ -963,7 +963,7 @@ msgstr "Determines how long a session lasts. Default of 0 seconds means that the
msgid "Device classes which can be used to authenticate." msgid "Device classes which can be used to authenticate."
msgstr "Device classes which can be used to authenticate." msgstr "Device classes which can be used to authenticate."
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:59 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:63
msgid "Device name" msgid "Device name"
msgstr "Device name" msgstr "Device name"
@ -981,11 +981,11 @@ msgstr "Digits"
msgid "Disable" msgid "Disable"
msgstr "Disable" msgstr "Disable"
#: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:51 #: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:55
msgid "Disable Static Tokens" msgid "Disable Static Tokens"
msgstr "Disable Static Tokens" msgstr "Disable Static Tokens"
#: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:36 #: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:40
msgid "Disable Time-based OTP" msgid "Disable Time-based OTP"
msgstr "Disable Time-based OTP" msgstr "Disable Time-based OTP"
@ -993,7 +993,7 @@ msgstr "Disable Time-based OTP"
msgid "Disabled" msgid "Disabled"
msgstr "Disabled" msgstr "Disabled"
#: src/pages/user-settings/settings/SourceSettingsOAuth.ts:41 #: src/pages/user-settings/settings/SourceSettingsOAuth.ts:37
msgid "Disconnect" msgid "Disconnect"
msgstr "Disconnect" msgstr "Disconnect"
@ -1096,13 +1096,13 @@ msgstr "Enable"
msgid "Enable StartTLS" msgid "Enable StartTLS"
msgstr "Enable StartTLS" msgstr "Enable StartTLS"
#: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:67 #: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:55
msgid "Enable Static Tokens" msgid "Enable Static Tokens"
msgstr "Enable Static Tokens" msgstr "Enable Static Tokens"
#: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:52 #: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:70
msgid "Enable Time-based OTP" msgid "Enable TOTP"
msgstr "Enable Time-based OTP" msgstr "Enable TOTP"
#: src/pages/policies/BoundPoliciesList.ts:37 #: src/pages/policies/BoundPoliciesList.ts:37
#: src/pages/policies/PolicyBindingForm.ts:198 #: src/pages/policies/PolicyBindingForm.ts:198
@ -2020,7 +2020,7 @@ msgstr "Not available"
msgid "Not configured action" msgid "Not configured action"
msgstr "Not configured action" msgstr "Not configured action"
#: src/pages/user-settings/settings/SourceSettingsOAuth.ts:44 #: src/pages/user-settings/settings/SourceSettingsOAuth.ts:40
msgid "Not connected." msgid "Not connected."
msgstr "Not connected." msgstr "Not connected."
@ -2822,7 +2822,7 @@ msgstr "Something went wrong! Please try again later."
msgid "Source" msgid "Source"
msgstr "Source" msgstr "Source"
#: src/pages/user-settings/settings/SourceSettingsOAuth.ts:21 #: src/pages/user-settings/settings/SourceSettingsOAuth.ts:18
msgid "Source {0}" msgid "Source {0}"
msgstr "Source {0}" msgstr "Source {0}"
@ -2901,10 +2901,13 @@ msgid "State"
msgstr "State" msgstr "State"
#: src/pages/stages/authenticator_validate/AuthenticatorValidateStageForm.ts:104 #: src/pages/stages/authenticator_validate/AuthenticatorValidateStageForm.ts:104
#: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:77
msgid "Static Tokens" msgid "Static Tokens"
msgstr "Static Tokens" msgstr "Static Tokens"
#: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:62
msgid "Static tokens"
msgstr "Static tokens"
#: src/pages/stages/prompt/PromptForm.ts:75 #: src/pages/stages/prompt/PromptForm.ts:75
msgid "Static: Static value, displayed as-is." msgid "Static: Static value, displayed as-is."
msgstr "Static: Static value, displayed as-is." msgstr "Static: Static value, displayed as-is."
@ -2917,13 +2920,13 @@ msgstr "Statically deny the flow. To use this stage effectively, disable *Evalua
msgid "Status" msgid "Status"
msgstr "Status" msgstr "Status"
#: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:44 #: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:48
#: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:59 #: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:63
msgid "Status: Disabled" msgid "Status: Disabled"
msgstr "Status: Disabled" msgstr "Status: Disabled"
#: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:18 #: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:22
#: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:22 #: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:26
msgid "Status: Enabled" msgid "Status: Enabled"
msgstr "Status: Enabled" msgstr "Status: Enabled"
@ -3104,7 +3107,7 @@ msgstr "Successfully updated certificate-key pair."
msgid "Successfully updated details." msgid "Successfully updated details."
msgstr "Successfully updated details." msgstr "Successfully updated details."
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:50 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:54
msgid "Successfully updated device." msgid "Successfully updated device."
msgstr "Successfully updated device." msgstr "Successfully updated device."
@ -3343,7 +3346,7 @@ msgstr "Time in minutes the token sent is valid."
msgid "Time offset when temporary users should be deleted. This only applies if your IDP uses the NameID Format 'transient', and the user doesn't log out manually. (Format: hours=1;minutes=2;seconds=3)." msgid "Time offset when temporary users should be deleted. This only applies if your IDP uses the NameID Format 'transient', and the user doesn't log out manually. (Format: hours=1;minutes=2;seconds=3)."
msgstr "Time offset when temporary users should be deleted. This only applies if your IDP uses the NameID Format 'transient', and the user doesn't log out manually. (Format: hours=1;minutes=2;seconds=3)." msgstr "Time offset when temporary users should be deleted. This only applies if your IDP uses the NameID Format 'transient', and the user doesn't log out manually. (Format: hours=1;minutes=2;seconds=3)."
#: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:62 #: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:77
msgid "Time-based One-Time Passwords" msgid "Time-based One-Time Passwords"
msgstr "Time-based One-Time Passwords" msgstr "Time-based One-Time Passwords"
@ -3490,9 +3493,9 @@ msgstr "Up-to-date!"
#: src/pages/stages/StageListPage.ts:85 #: src/pages/stages/StageListPage.ts:85
#: src/pages/stages/prompt/PromptListPage.ts:67 #: src/pages/stages/prompt/PromptListPage.ts:67
#: src/pages/user-settings/UserDetailsPage.ts:81 #: src/pages/user-settings/UserDetailsPage.ts:81
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:43 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:47
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:46 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:50
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:67 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:71
#: src/pages/user-settings/tokens/UserTokenList.ts:105 #: src/pages/user-settings/tokens/UserTokenList.ts:105
#: src/pages/users/UserActiveForm.ts:66 #: src/pages/users/UserActiveForm.ts:66
#: src/pages/users/UserListPage.ts:68 #: src/pages/users/UserListPage.ts:68
@ -3788,7 +3791,7 @@ msgstr "Warning: Provider not assigned to any application."
msgid "WebAuthn Authenticators" msgid "WebAuthn Authenticators"
msgstr "WebAuthn Authenticators" msgstr "WebAuthn Authenticators"
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:74 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:78
msgid "WebAuthn Devices" msgid "WebAuthn Devices"
msgstr "WebAuthn Devices" msgstr "WebAuthn Devices"

View File

@ -276,7 +276,7 @@ msgid "Authentication flow"
msgstr "" msgstr ""
#: src/flows/stages/authenticator_validate/AuthenticatorValidateStage.ts:63 #: src/flows/stages/authenticator_validate/AuthenticatorValidateStage.ts:63
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:29 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:33
msgid "Authenticator" msgid "Authenticator"
msgstr "" msgstr ""
@ -582,7 +582,7 @@ msgstr ""
msgid "Configuration flow" msgid "Configuration flow"
msgstr "" msgstr ""
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:103 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:106
msgid "Configure WebAuthn" msgid "Configure WebAuthn"
msgstr "" msgstr ""
@ -602,11 +602,11 @@ msgstr ""
msgid "Configure what data should be used as unique User Identifier. For most cases, the default should be fine." msgid "Configure what data should be used as unique User Identifier. For most cases, the default should be fine."
msgstr "" msgstr ""
#: src/pages/user-settings/settings/SourceSettingsOAuth.ts:47 #: src/pages/user-settings/settings/SourceSettingsOAuth.ts:43
msgid "Connect" msgid "Connect"
msgstr "" msgstr ""
#: src/pages/user-settings/settings/SourceSettingsOAuth.ts:34 #: src/pages/user-settings/settings/SourceSettingsOAuth.ts:30
msgid "Connected." msgid "Connected."
msgstr "" msgstr ""
@ -826,7 +826,7 @@ msgstr ""
msgid "Created by" msgid "Created by"
msgstr "" msgstr ""
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:86 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:90
msgid "Created {0}" msgid "Created {0}"
msgstr "" msgstr ""
@ -878,7 +878,7 @@ msgstr ""
#: src/pages/stages/invitation/InvitationListPage.ts:68 #: src/pages/stages/invitation/InvitationListPage.ts:68
#: src/pages/stages/prompt/PromptListPage.ts:87 #: src/pages/stages/prompt/PromptListPage.ts:87
#: src/pages/tokens/TokenListPage.ts:68 #: src/pages/tokens/TokenListPage.ts:68
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:36 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:40
#: src/pages/user-settings/tokens/UserTokenList.ts:125 #: src/pages/user-settings/tokens/UserTokenList.ts:125
#: src/pages/users/UserListPage.ts:115 #: src/pages/users/UserListPage.ts:115
msgid "Delete" msgid "Delete"
@ -955,7 +955,7 @@ msgstr ""
msgid "Device classes which can be used to authenticate." msgid "Device classes which can be used to authenticate."
msgstr "" msgstr ""
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:59 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:63
msgid "Device name" msgid "Device name"
msgstr "" msgstr ""
@ -973,11 +973,11 @@ msgstr ""
msgid "Disable" msgid "Disable"
msgstr "" msgstr ""
#: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:51 #: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:55
msgid "Disable Static Tokens" msgid "Disable Static Tokens"
msgstr "" msgstr ""
#: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:36 #: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:40
msgid "Disable Time-based OTP" msgid "Disable Time-based OTP"
msgstr "" msgstr ""
@ -985,7 +985,7 @@ msgstr ""
msgid "Disabled" msgid "Disabled"
msgstr "" msgstr ""
#: src/pages/user-settings/settings/SourceSettingsOAuth.ts:41 #: src/pages/user-settings/settings/SourceSettingsOAuth.ts:37
msgid "Disconnect" msgid "Disconnect"
msgstr "" msgstr ""
@ -1088,12 +1088,12 @@ msgstr ""
msgid "Enable StartTLS" msgid "Enable StartTLS"
msgstr "" msgstr ""
#: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:67 #: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:55
msgid "Enable Static Tokens" msgid "Enable Static Tokens"
msgstr "" msgstr ""
#: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:52 #: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:70
msgid "Enable Time-based OTP" msgid "Enable TOTP"
msgstr "" msgstr ""
#: src/pages/policies/BoundPoliciesList.ts:37 #: src/pages/policies/BoundPoliciesList.ts:37
@ -2012,7 +2012,7 @@ msgstr ""
msgid "Not configured action" msgid "Not configured action"
msgstr "" msgstr ""
#: src/pages/user-settings/settings/SourceSettingsOAuth.ts:44 #: src/pages/user-settings/settings/SourceSettingsOAuth.ts:40
msgid "Not connected." msgid "Not connected."
msgstr "" msgstr ""
@ -2814,7 +2814,7 @@ msgstr ""
msgid "Source" msgid "Source"
msgstr "" msgstr ""
#: src/pages/user-settings/settings/SourceSettingsOAuth.ts:21 #: src/pages/user-settings/settings/SourceSettingsOAuth.ts:18
msgid "Source {0}" msgid "Source {0}"
msgstr "" msgstr ""
@ -2893,10 +2893,13 @@ msgid "State"
msgstr "" msgstr ""
#: src/pages/stages/authenticator_validate/AuthenticatorValidateStageForm.ts:104 #: src/pages/stages/authenticator_validate/AuthenticatorValidateStageForm.ts:104
#: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:77
msgid "Static Tokens" msgid "Static Tokens"
msgstr "" msgstr ""
#: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:62
msgid "Static tokens"
msgstr ""
#: src/pages/stages/prompt/PromptForm.ts:75 #: src/pages/stages/prompt/PromptForm.ts:75
msgid "Static: Static value, displayed as-is." msgid "Static: Static value, displayed as-is."
msgstr "" msgstr ""
@ -2909,13 +2912,13 @@ msgstr ""
msgid "Status" msgid "Status"
msgstr "" msgstr ""
#: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:44 #: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:48
#: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:59 #: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:63
msgid "Status: Disabled" msgid "Status: Disabled"
msgstr "" msgstr ""
#: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:18 #: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:22
#: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:22 #: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:26
msgid "Status: Enabled" msgid "Status: Enabled"
msgstr "" msgstr ""
@ -3096,7 +3099,7 @@ msgstr ""
msgid "Successfully updated details." msgid "Successfully updated details."
msgstr "" msgstr ""
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:50 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:54
msgid "Successfully updated device." msgid "Successfully updated device."
msgstr "" msgstr ""
@ -3333,7 +3336,7 @@ msgstr ""
msgid "Time offset when temporary users should be deleted. This only applies if your IDP uses the NameID Format 'transient', and the user doesn't log out manually. (Format: hours=1;minutes=2;seconds=3)." msgid "Time offset when temporary users should be deleted. This only applies if your IDP uses the NameID Format 'transient', and the user doesn't log out manually. (Format: hours=1;minutes=2;seconds=3)."
msgstr "" msgstr ""
#: src/pages/user-settings/settings/UserSettingsAuthenticatorStatic.ts:62 #: src/pages/user-settings/settings/UserSettingsAuthenticatorTOTP.ts:77
msgid "Time-based One-Time Passwords" msgid "Time-based One-Time Passwords"
msgstr "" msgstr ""
@ -3480,9 +3483,9 @@ msgstr ""
#: src/pages/stages/StageListPage.ts:85 #: src/pages/stages/StageListPage.ts:85
#: src/pages/stages/prompt/PromptListPage.ts:67 #: src/pages/stages/prompt/PromptListPage.ts:67
#: src/pages/user-settings/UserDetailsPage.ts:81 #: src/pages/user-settings/UserDetailsPage.ts:81
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:43 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:47
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:46 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:50
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:67 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:71
#: src/pages/user-settings/tokens/UserTokenList.ts:105 #: src/pages/user-settings/tokens/UserTokenList.ts:105
#: src/pages/users/UserActiveForm.ts:66 #: src/pages/users/UserActiveForm.ts:66
#: src/pages/users/UserListPage.ts:68 #: src/pages/users/UserListPage.ts:68
@ -3778,7 +3781,7 @@ msgstr ""
msgid "WebAuthn Authenticators" msgid "WebAuthn Authenticators"
msgstr "" msgstr ""
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:74 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:78
msgid "WebAuthn Devices" msgid "WebAuthn Devices"
msgstr "" msgstr ""

View File

@ -1,6 +1,6 @@
import { AuthenticatorsApi, StagesApi } from "authentik-api"; import { AuthenticatorsApi } from "authentik-api";
import { t } from "@lingui/macro"; import { t } from "@lingui/macro";
import { customElement, html, TemplateResult } from "lit-element"; import { customElement, html, property, TemplateResult } from "lit-element";
import { until } from "lit-html/directives/until"; import { until } from "lit-html/directives/until";
import { DEFAULT_CONFIG } from "../../../api/Config"; import { DEFAULT_CONFIG } from "../../../api/Config";
import { FlowURLManager } from "../../../api/legacy"; import { FlowURLManager } from "../../../api/legacy";
@ -9,6 +9,9 @@ import { BaseUserSettings } from "./BaseUserSettings";
@customElement("ak-user-settings-authenticator-static") @customElement("ak-user-settings-authenticator-static")
export class UserSettingsAuthenticatorStatic extends BaseUserSettings { export class UserSettingsAuthenticatorStatic extends BaseUserSettings {
@property({ type: Boolean })
configureFlow = false;
renderEnabled(): TemplateResult { renderEnabled(): TemplateResult {
return html`<div class="pf-c-card__body"> return html`<div class="pf-c-card__body">
<p> <p>
@ -44,21 +47,17 @@ export class UserSettingsAuthenticatorStatic extends BaseUserSettings {
</p> </p>
</div> </div>
<div class="pf-c-card__footer"> <div class="pf-c-card__footer">
${until(new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorTotpRead({ stageUuid: this.objectId}).then((stage) => { ${this.configureFlow ?
if (stage.configureFlow) { html`<a href="${FlowURLManager.configure(this.objectId || "", "?next=/%23%2Fuser")}"
return html`<a href="${FlowURLManager.configure(stage.pk || "", "?next=/%23%2Fuser")}" class="pf-c-button pf-m-primary">${t`Enable Static Tokens`}
class="pf-c-button pf-m-primary">${t`Enable Time-based OTP`} </a>`: html``}
</a>`;
}
return html``;
}))}
</div>`; </div>`;
} }
render(): TemplateResult { render(): TemplateResult {
return html`<div class="pf-c-card"> return html`<div class="pf-c-card">
<div class="pf-c-card__title"> <div class="pf-c-card__title">
${t`Time-based One-Time Passwords`} ${t`Static tokens`}
</div> </div>
${until(new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsTotpList({}).then((devices) => { ${until(new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsTotpList({}).then((devices) => {
return devices.results.length > 0 ? this.renderEnabled() : this.renderDisabled(); return devices.results.length > 0 ? this.renderEnabled() : this.renderDisabled();

View File

@ -1,6 +1,6 @@
import { AuthenticatorsApi, StagesApi } from "authentik-api"; import { AuthenticatorsApi } from "authentik-api";
import { t } from "@lingui/macro"; import { t } from "@lingui/macro";
import { CSSResult, customElement, html, TemplateResult } from "lit-element"; import { CSSResult, customElement, html, property, TemplateResult } from "lit-element";
import { until } from "lit-html/directives/until"; import { until } from "lit-html/directives/until";
import { DEFAULT_CONFIG } from "../../../api/Config"; import { DEFAULT_CONFIG } from "../../../api/Config";
import { FlowURLManager } from "../../../api/legacy"; import { FlowURLManager } from "../../../api/legacy";
@ -10,6 +10,9 @@ import { BaseUserSettings } from "./BaseUserSettings";
@customElement("ak-user-settings-authenticator-totp") @customElement("ak-user-settings-authenticator-totp")
export class UserSettingsAuthenticatorTOTP extends BaseUserSettings { export class UserSettingsAuthenticatorTOTP extends BaseUserSettings {
@property({ type: Boolean })
configureFlow = false;
static get styles(): CSSResult[] { static get styles(): CSSResult[] {
return super.styles.concat(STATIC_TOKEN_STYLE); return super.styles.concat(STATIC_TOKEN_STYLE);
} }
@ -59,21 +62,17 @@ export class UserSettingsAuthenticatorTOTP extends BaseUserSettings {
</p> </p>
</div> </div>
<div class="pf-c-card__footer"> <div class="pf-c-card__footer">
${until(new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorStaticRead({ stageUuid: this.objectId}).then((stage) => { ${this.configureFlow ?
if (stage.configureFlow) { html`<a href="${FlowURLManager.configure(this.objectId || "", "?next=/%23%2Fuser")}"
return html`<a href="${FlowURLManager.configure(stage.pk || "", "?next=/%23%2Fuser")}" class="pf-c-button pf-m-primary">${t`Enable TOTP`}
class="pf-c-button pf-m-primary">${t`Enable Static Tokens`} </a>`: html``}
</a>`;
}
return html``;
}))}
</div>`; </div>`;
} }
render(): TemplateResult { render(): TemplateResult {
return html`<div class="pf-c-card"> return html`<div class="pf-c-card">
<div class="pf-c-card__title"> <div class="pf-c-card__title">
${t`Static Tokens`} ${t`Time-based One-Time Passwords`}
</div> </div>
${until(new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsTotpList({}).then((devices) => { ${until(new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsTotpList({}).then((devices) => {
return devices.results.length > 0 ? this.renderEnabled() : this.renderDisabled(); return devices.results.length > 0 ? this.renderEnabled() : this.renderDisabled();

View File

@ -1,6 +1,6 @@
import { CSSResult, customElement, html, TemplateResult } from "lit-element"; import { CSSResult, customElement, html, property, TemplateResult } from "lit-element";
import { t } from "@lingui/macro"; import { t } from "@lingui/macro";
import { AuthenticatorsApi, StagesApi, WebAuthnDevice } from "authentik-api"; import { AuthenticatorsApi, WebAuthnDevice } from "authentik-api";
import { until } from "lit-html/directives/until"; import { until } from "lit-html/directives/until";
import { FlowURLManager } from "../../../api/legacy"; import { FlowURLManager } from "../../../api/legacy";
import { DEFAULT_CONFIG } from "../../../api/Config"; import { DEFAULT_CONFIG } from "../../../api/Config";
@ -17,6 +17,9 @@ import { ifDefined } from "lit-html/directives/if-defined";
@customElement("ak-user-settings-authenticator-webauthn") @customElement("ak-user-settings-authenticator-webauthn")
export class UserSettingsAuthenticatorWebAuthn extends BaseUserSettings { export class UserSettingsAuthenticatorWebAuthn extends BaseUserSettings {
@property({type: Boolean})
configureFlow = false;
static get styles(): CSSResult[] { static get styles(): CSSResult[] {
return super.styles.concat(PFDataList); return super.styles.concat(PFDataList);
} }
@ -96,14 +99,10 @@ export class UserSettingsAuthenticatorWebAuthn extends BaseUserSettings {
</ul> </ul>
</div> </div>
<div class="pf-c-card__footer"> <div class="pf-c-card__footer">
${until(new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorWebauthnRead({ stageUuid: this.objectId}).then((stage) => { ${this.configureFlow ?
if (stage.configureFlow) { html`<a href="${FlowURLManager.configure(this.objectId || "", "?next=/%23%2Fuser")}"
return html`<a href="${FlowURLManager.configure(stage.pk || "", "?next=/%23%2Fuser")}" class="pf-c-button pf-m-primary">${t`Configure WebAuthn`}
class="pf-c-button pf-m-primary">${t`Configure WebAuthn`} </a>`: html``}
</a>`;
}
return html``;
}))}
</div> </div>
</div>`; </div>`;
} }