Class: Symphonia::LoginController
Instance Method Summary
collapse
#admin_require, #authorize, #back_url, #current_user, #current_user_session, #handle_unverified_request, #login_require, #menu_item, #redirect_back_or_default, #redirect_to_referer_or, #render_403, #render_404, #render_api_head, #render_api_ok, #set_default_locale, #set_locale, #store_location
Instance Method Details
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/symphonia/login_controller.rb', line 22
def create
@model_session = "#{current_model}Session".constantize.new(login_session_params)
if @model_session.save
current_model.constantize.current = @model_session.user
redirect_to after_login_path
else
render :new
end
end
|
36
37
38
39
40
|
# File 'app/controllers/symphonia/login_controller.rb', line 36
def destroy
current_session && current_session.destroy
session.delete :return_to
redirect_to '/', notice: t(:text_successfully_logout)
end
|
6
7
8
9
10
11
12
|
# File 'app/controllers/symphonia/login_controller.rb', line 6
def index
if current_model.constantize.current.logged_in?
return destroy
else
return new
end
end
|
#login_session_params ⇒ Object
32
33
34
|
# File 'app/controllers/symphonia/login_controller.rb', line 32
def login_session_params
params.require(:login_session).permit(:login, :password, :remember_me).to_h
end
|
14
15
16
17
18
19
20
|
# File 'app/controllers/symphonia/login_controller.rb', line 14
def new
if current_model.constantize.current.logged_in?
return redirect_to(after_login_path)
end
@model_session = "#{current_model}Session".constantize.new
render :new
end
|