mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 19:48:28 +02:00
Make Registrant/Registrar use same TARA controller
This commit is contained in:
parent
11ee1f9f1e
commit
f83e532fb1
5 changed files with 56 additions and 84 deletions
|
@ -1,33 +0,0 @@
|
|||
class Registrant
|
||||
class TaraController < ApplicationController
|
||||
skip_authorization_check
|
||||
|
||||
# rubocop:disable Style/AndOr
|
||||
def callback
|
||||
session[:omniauth_hash] = user_hash
|
||||
@registrant_user = RegistrantUser.find_or_create_by_omniauth_data(user_hash)
|
||||
|
||||
if @registrant_user
|
||||
flash[:notice] = t(:signed_in_successfully)
|
||||
sign_in_and_redirect(:registrant_user, @registrant_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_registrant_user_session_url, alert: t(:no_such_user)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def user_hash
|
||||
request.env['omniauth.auth']
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue