Class: SessionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- SessionsController
- Defined in:
- lib/generators/mindapp/templates/app/controllers/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
10 11 12 13 14 15 16 |
# File 'lib/generators/mindapp/templates/app/controllers/sessions_controller.rb', line 10 def create user = User.from_omniauth(env["omniauth.auth"]) session[:user_id] = user.id redirect_to '/mindapp/pending' rescue redirect_to root_path, :alert=> "Authentication failed, please try again." end |
#destroy ⇒ Object
18 19 20 21 22 |
# File 'lib/generators/mindapp/templates/app/controllers/sessions_controller.rb', line 18 def destroy session[:user_id] = nil # redirect_to '/mindapp/help' refresh_to root_path end |
#failure ⇒ Object
24 25 26 27 |
# File 'lib/generators/mindapp/templates/app/controllers/sessions_controller.rb', line 24 def failure ma_log "Authentication failed, please try again." redirect_to root_path, :alert=> "Authentication failed, please try again." end |
#new ⇒ Object
3 4 5 |
# File 'lib/generators/mindapp/templates/app/controllers/sessions_controller.rb', line 3 def new @title= 'Sign In' end |