mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 18:56:05 +02:00
Add error if no API user found
This commit is contained in:
parent
96c0d09c07
commit
42488b4ee8
1 changed files with 11 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue