mirror of
https://github.com/we-promise/sure.git
synced 2026-04-22 21:44:11 +00:00
Centralize auth (#598)
This commit is contained in:
@@ -2,7 +2,13 @@ module Authentication
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
helper_method :user_signed_in?
|
||||
before_action :authenticate_user!
|
||||
end
|
||||
|
||||
class_methods do
|
||||
def skip_authentication(**options)
|
||||
skip_before_action :authenticate_user!, **options
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
@@ -15,10 +21,6 @@ module Authentication
|
||||
end
|
||||
end
|
||||
|
||||
def user_signed_in?
|
||||
Current.user.present?
|
||||
end
|
||||
|
||||
def login(user)
|
||||
Current.user = user
|
||||
reset_session
|
||||
|
||||
Reference in New Issue
Block a user