Class: Authorio::AuthorioController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Authorio::AuthorioController
show all
- Defined in:
- app/controllers/authorio/authorio_controller.rb
Instance Method Summary
collapse
Instance Method Details
#authorized? ⇒ Boolean
34
35
36
|
# File 'app/controllers/authorio/authorio_controller.rb', line 34
def authorized?
redirect_to new_session_path unless logged_in?
end
|
#current_user ⇒ Object
38
39
40
|
# File 'app/controllers/authorio/authorio_controller.rb', line 38
def current_user
user_session&.authorio_user&.id
end
|
#index ⇒ Object
10
11
12
13
14
15
16
|
# File 'app/controllers/authorio/authorio_controller.rb', line 10
def index
if logged_in?
redirect_to edit_user_path(current_user)
else
redirect_to new_session_path
end
end
|
#logged_in? ⇒ Boolean
26
27
28
|
# File 'app/controllers/authorio/authorio_controller.rb', line 26
def logged_in?
!user_session.nil?
end
|
#profile_url(user) ⇒ Object
46
47
48
49
50
51
52
|
# File 'app/controllers/authorio/authorio_controller.rb', line 46
def profile_url(user)
if Authorio.configuration.multiuser
verify_user_url(user)
else
"#{request.scheme}://#{request.host}"
end
end
|
#rememberable? ⇒ Boolean
30
31
32
|
# File 'app/controllers/authorio/authorio_controller.rb', line 30
def rememberable?
!logged_in? && Authorio.configuration.local_session_lifetime
end
|
#user_scope_description(scope) ⇒ Object
#user_session ⇒ Object
18
19
20
21
22
23
24
|
# File 'app/controllers/authorio/authorio_controller.rb', line 18
def user_session
if session[:user_id]
Session.new(authorio_user: Authorio::User.find(session[:user_id]))
else
cookie = cookies.encrypted[:user] and Session.find_by_cookie(cookie)
end
end
|