diff --git a/app/controllers/registrar/tara_controller.rb b/app/controllers/registrar/tara_controller.rb index 9107e46ce..84938a777 100644 --- a/app/controllers/registrar/tara_controller.rb +++ b/app/controllers/registrar/tara_controller.rb @@ -2,19 +2,27 @@ class Registrar class TaraController < ApplicationController skip_authorization_check + # rubocop:disable Style/AndOr def callback session[:omniauth_hash] = user_hash @api_user = ApiUser.from_omniauth(user_hash) - return unless @api_user - - sign_in_and_redirect(:registrar_user, @api_user) + if @api_user + sign_in_and_redirect(:registrar_user, @api_user) + else + show_error and return + end end + # rubocop:enable Style/AndOr def cancel redirect_to root_path, notice: t(:sign_in_cancelled) end + def show_error + redirect_to new_registrar_user_session_url, alert: t(:no_such_user) + end + private def user_hash