mirror of
https://github.com/internetee/registry.git
synced 2025-06-13 16:14:47 +02:00
Cleanup
This commit is contained in:
parent
bb37527dae
commit
0d716e110a
4 changed files with 4 additions and 54 deletions
|
@ -11,47 +11,14 @@ class Registrar
|
||||||
sign_in_and_redirect(:registrar_user, @api_user)
|
sign_in_and_redirect(:registrar_user, @api_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Metrics/MethodLength
|
|
||||||
# def create
|
|
||||||
# @user = User.new(create_params)
|
|
||||||
# check_for_tampering
|
|
||||||
# create_password
|
|
||||||
#
|
|
||||||
# respond_to do |format|
|
|
||||||
# if @user.save
|
|
||||||
# format.html do
|
|
||||||
# sign_in(User, @user)
|
|
||||||
# redirect_to user_path(@user.uuid), notice: t(:created)
|
|
||||||
# end
|
|
||||||
# else
|
|
||||||
# format.html { render :callback }
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# rubocop:enable Metrics/MethodLength
|
|
||||||
|
|
||||||
def cancel
|
def cancel
|
||||||
redirect_to root_path, notice: t(:sign_in_cancelled)
|
redirect_to root_path, notice: t(:sign_in_cancelled)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# def create_params
|
|
||||||
# params.require(:user)
|
|
||||||
# .permit(:email, :identity_code, :country_code, :given_names, :surname,
|
|
||||||
# :accepts_terms_and_conditions, :locale, :uid, :provider)
|
|
||||||
# end
|
|
||||||
|
|
||||||
# def create_password
|
|
||||||
# @user.password = Devise.friendly_token[0..20]
|
|
||||||
# end
|
|
||||||
|
|
||||||
def user_hash
|
def user_hash
|
||||||
request.env['omniauth.auth']
|
request.env['omniauth.auth']
|
||||||
end
|
end
|
||||||
|
|
||||||
def tara_logger
|
|
||||||
@tara_logger ||= Logger.new(Rails.root.join('log', 'tara_auth4.log'))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class RegistrantUser < User
|
class RegistrantUser < User
|
||||||
attr_accessor :idc_data
|
attr_accessor :idc_data
|
||||||
|
|
||||||
devise :trackable, :timeoutable#, :id_card_authenticatable
|
devise :trackable, :timeoutable
|
||||||
|
|
||||||
def ability
|
def ability
|
||||||
@ability ||= Ability.new(self)
|
@ability ||= Ability.new(self)
|
||||||
|
|
|
@ -14,28 +14,12 @@ class User < ApplicationRecord
|
||||||
"#{self.id}-#{self.class}: #{self.username}"
|
"#{self.id}-#{self.class}: #{self.username}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Metrics/AbcSize
|
|
||||||
# def tampered_with?(omniauth_hash)
|
|
||||||
# # uid_from_hash = omniauth_hash['uid']
|
|
||||||
# # provider_from_hash = omniauth_hash['provider']
|
|
||||||
# #
|
|
||||||
# # begin
|
|
||||||
# # uid != uid_from_hash ||
|
|
||||||
# # provider != provider_from_hash ||
|
|
||||||
# # country_code != uid_from_hash.slice(0..1) ||
|
|
||||||
# # identity_code != uid_from_hash.slice(2..-1) ||
|
|
||||||
# # given_names != omniauth_hash.dig('info', 'first_name') ||
|
|
||||||
# # surname != omniauth_hash.dig('info', 'last_name')
|
|
||||||
# # end
|
|
||||||
# false
|
|
||||||
# end
|
|
||||||
# rubocop:enable Metrics/AbcSize
|
|
||||||
|
|
||||||
def self.from_omniauth(omniauth_hash)
|
def self.from_omniauth(omniauth_hash)
|
||||||
uid = omniauth_hash['uid']
|
uid = omniauth_hash['uid']
|
||||||
# provider = omniauth_hash['provider']
|
identity_code = uid.slice(2..-1)
|
||||||
|
country_code = uid.slice(0..1)
|
||||||
|
|
||||||
User.find_by(uid: uid)
|
User.find_by(identity_code: identity_code, country_code: country_code)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -89,7 +89,6 @@ Rails.application.routes.draw do
|
||||||
match '/open_id/callback', via: %i[get post], to: 'tara#callback', as: :tara_callback
|
match '/open_id/callback', via: %i[get post], to: 'tara#callback', as: :tara_callback
|
||||||
match '/open_id/cancel', via: %i[get post delete], to: 'tara#cancel',
|
match '/open_id/cancel', via: %i[get post delete], to: 'tara#cancel',
|
||||||
as: :tara_cancel
|
as: :tara_cancel
|
||||||
# match '/open_id/create', via: [:post], to: 'tara#create', as: :tara_create
|
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :invoices, except: %i[new create edit update destroy] do
|
resources :invoices, except: %i[new create edit update destroy] do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue