diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-06-23 12:49:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-23 12:49:09 +0200 |
commit | 776e00f19399875a135a64d8ad486f3578101cf9 (patch) | |
tree | ea846e21767b1cb2f9f277d3829fbade1f0e46a0 /app/controllers/concerns | |
parent | a434f370f38ac66e05000545e36d7c696f4962d0 (diff) | |
parent | 979059fbc93664b38b720b369b31beaa89457879 (diff) |
Merge pull request #1551 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/controllers/concerns')
-rw-r--r-- | app/controllers/concerns/sign_in_token_authentication_concern.rb | 5 | ||||
-rw-r--r-- | app/controllers/concerns/two_factor_authentication_concern.rb | 10 |
2 files changed, 6 insertions, 9 deletions
diff --git a/app/controllers/concerns/sign_in_token_authentication_concern.rb b/app/controllers/concerns/sign_in_token_authentication_concern.rb index 51ebcb115..016ab8f52 100644 --- a/app/controllers/concerns/sign_in_token_authentication_concern.rb +++ b/app/controllers/concerns/sign_in_token_authentication_concern.rb @@ -29,10 +29,9 @@ module SignInTokenAuthenticationConcern def authenticate_with_sign_in_token_attempt(user) if valid_sign_in_token_attempt?(user) - clear_attempt_from_session - remember_me(user) - sign_in(user) + on_authentication_success(user, :sign_in_token) else + on_authentication_failure(user, :sign_in_token, :invalid_sign_in_token) flash.now[:alert] = I18n.t('users.invalid_sign_in_token') prompt_for_sign_in_token(user) end diff --git a/app/controllers/concerns/two_factor_authentication_concern.rb b/app/controllers/concerns/two_factor_authentication_concern.rb index 4800db348..d3f00a4b4 100644 --- a/app/controllers/concerns/two_factor_authentication_concern.rb +++ b/app/controllers/concerns/two_factor_authentication_concern.rb @@ -52,21 +52,19 @@ module TwoFactorAuthenticationConcern webauthn_credential = WebAuthn::Credential.from_get(user_params[:credential]) if valid_webauthn_credential?(user, webauthn_credential) - clear_attempt_from_session - remember_me(user) - sign_in(user) + on_authentication_success(user, :webauthn) render json: { redirect_path: root_path }, status: :ok else + on_authentication_failure(user, :webauthn, :invalid_credential) render json: { error: t('webauthn_credentials.invalid_credential') }, status: :unprocessable_entity end end def authenticate_with_two_factor_via_otp(user) if valid_otp_attempt?(user) - clear_attempt_from_session - remember_me(user) - sign_in(user) + on_authentication_success(user, :otp) else + on_authentication_failure(user, :otp, :invalid_otp_token) flash.now[:alert] = I18n.t('users.invalid_otp_token') prompt_for_two_factor(user) end |