diff --git a/app/assets/javascripts/discourse/controllers/second-factor-add-security-key.js.es6 b/app/assets/javascripts/discourse/controllers/second-factor-add-security-key.js.es6 index 6106d2602b4..4d614000ed4 100644 --- a/app/assets/javascripts/discourse/controllers/second-factor-add-security-key.js.es6 +++ b/app/assets/javascripts/discourse/controllers/second-factor-add-security-key.js.es6 @@ -109,6 +109,12 @@ export default Ember.Controller.extend(ModalFunctionality, { .finally(() => this.set("loading", false)); }, err => { + if (err.name === "InvalidStateError") { + return this.set( + "errorMessage", + I18n.t("user.second_factor.security_key.already_added_error") + ); + } if (err.name === "NotAllowedError") { return this.set( "errorMessage", diff --git a/app/assets/javascripts/discourse/templates/components/cancel-link.hbs b/app/assets/javascripts/discourse/templates/components/cancel-link.hbs index 8c3a3cb4c7e..4455e8b8d43 100644 --- a/app/assets/javascripts/discourse/templates/components/cancel-link.hbs +++ b/app/assets/javascripts/discourse/templates/components/cancel-link.hbs @@ -1,3 +1,3 @@ -{{#link-to route args}} +{{#link-to route args class="cancel"}} {{i18n 'cancel'}} {{/link-to}} diff --git a/app/assets/javascripts/discourse/templates/mobile/modal/login.hbs b/app/assets/javascripts/discourse/templates/mobile/modal/login.hbs index 594ea48603d..49ac40cbc57 100644 --- a/app/assets/javascripts/discourse/templates/mobile/modal/login.hbs +++ b/app/assets/javascripts/discourse/templates/mobile/modal/login.hbs @@ -40,8 +40,21 @@ secondFactorMethod=secondFactorMethod secondFactorToken=secondFactorToken class=secondFactorClass + backupEnabled=backupEnabled isLogin=true}} - {{second-factor-input value=secondFactorToken inputId='login-second-factor' secondFactorMethod=secondFactorMethod backupEnabled=backupEnabled}} + {{#if showSecurityKey}} + {{#security-key-form + allowedCredentialIds=securityKeyAllowedCredentialIds + challenge=securityKeyChallenge + showSecurityKey=showSecurityKey + showSecondFactor=showSecondFactor + secondFactorMethod=secondFactorMethod + otherMethodAllowed=secondFactorRequired + action=(action "authenticateSecurityKey")}} + {{/security-key-form}} + {{else}} + {{second-factor-input value=secondFactorToken inputId='login-second-factor' secondFactorMethod=secondFactorMethod backupEnabled=backupEnabled}} + {{/if}} {{/second-factor-form}} {{/if}} @@ -54,11 +67,13 @@ {{/if}} {{#if canLoginLocal}} - {{d-button action=(action "login") - icon="unlock" - label=loginButtonLabel - disabled=loginDisabled - class="btn btn-large btn-primary"}} + {{#unless showSecurityKey }} + {{d-button action=(action "login") + icon="unlock" + label=loginButtonLabel + disabled=loginDisabled + class="btn btn-large btn-primary"}} + {{/unless}} {{#if showSignupLink}} {{#d-button class="btn btn-large" id="new-account-link" action=(route-action "showCreateAccount")}} diff --git a/app/assets/javascripts/discourse/templates/modal/second-factor-edit-security-key.hbs b/app/assets/javascripts/discourse/templates/modal/second-factor-edit-security-key.hbs index 5bfaa9b221c..7de9e5a2ada 100644 --- a/app/assets/javascripts/discourse/templates/modal/second-factor-edit-security-key.hbs +++ b/app/assets/javascripts/discourse/templates/modal/second-factor-edit-security-key.hbs @@ -11,5 +11,5 @@ {{d-button action=(action "disableSecurityKey") class="btn-danger" - label="user.second_factor.security_key.disable"}} + label="user.second_factor.security_key.delete"}} {{/d-modal-body}} diff --git a/app/assets/javascripts/discourse/templates/preferences-second-factor.hbs b/app/assets/javascripts/discourse/templates/preferences-second-factor.hbs index 7bacef496ae..1b6bb0dd1cc 100644 --- a/app/assets/javascripts/discourse/templates/preferences-second-factor.hbs +++ b/app/assets/javascripts/discourse/templates/preferences-second-factor.hbs @@ -126,7 +126,7 @@ {{text-field value=password id="password" type="password" - classNames="input-xxlarge" + classNames="input-large" autofocus="autofocus"}}