Class: Jinda::SessionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Jinda::SessionsController
- Defined in:
- app/controllers/jindra_engine/sessions_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
to refresh the page, must know BEFOREHAND that the action needs refresh then use attribute ‘data-ajax’=>‘false’ see app/views/sessions/new.html.erb for sample.
- #destroy ⇒ Object
- #failure ⇒ Object
- #new ⇒ Object
Instance Method Details
#create ⇒ Object
to refresh the page, must know BEFOREHAND that the action needs refresh then use attribute ‘data-ajax’=>‘false’ see app/views/sessions/new.html.erb for sample
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/jindra_engine/sessions_controller.rb', line 15 def create auth = request.env["omniauth.auth"] user = User.from_omniauth(auth) session[:user_id] = user.id if params.permit[:remember_me] .permanent[:auth_token] = user.auth_token else [:auth_token] = user.auth_token end # refresh_to root_path, :ma_notice => "Logged in" # Called by jinda_conroller # redirect_to root_path redirect_to articles_my_path rescue redirect_to root_path, :alert=> "Authentication failed, please try again." end |
#destroy ⇒ Object
32 33 34 35 36 37 38 |
# File 'app/controllers/jindra_engine/sessions_controller.rb', line 32 def destroy session[:user_id] = nil .delete(:auth_token) refresh_to root_path, :ma_notice => "Logged Out" # called by jinda_controller, not pass tested # redirect_to root_path # Ok with test end |
#failure ⇒ Object
8 9 10 |
# File 'app/controllers/jindra_engine/sessions_controller.rb', line 8 def failure redirect_to login_path, alert: "Authentication failed, please try again." end |
#new ⇒ Object
4 5 6 |
# File 'app/controllers/jindra_engine/sessions_controller.rb', line 4 def new @title= 'Sign In' end |