Class: SessionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- SessionsController
- Defined in:
- lib/generators/authpro/templates/sessions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/generators/authpro/templates/sessions_controller.rb', line 6 def create @user = User.authenticate(params[:email], params[:password]) if @user if params[:remember_me] .permanent[:auth_token] = @user.auth_token else [:auth_token] = @user.auth_token end redirect_to root_url, notice: "Logged in!" else flash.now.alert = "Invalid email or password" render "new" end end |
#destroy ⇒ Object
22 23 24 25 |
# File 'lib/generators/authpro/templates/sessions_controller.rb', line 22 def destroy .delete(:auth_token) redirect_to root_url, notice: "Logged out!" end |
#new ⇒ Object
3 4 |
# File 'lib/generators/authpro/templates/sessions_controller.rb', line 3 def new end |