Class: AccountController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- AccountController
- Includes:
- LoginSystem
- Defined in:
- app/controllers/account_controller.rb
Instance Method Summary collapse
Instance Method Details
#login ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/account_controller.rb', line 6 def login case @request.method when :post if @session[:user] = User.authenticate(@params[:user_login], @params[:user_password]) flash['notice'] = "Login successful" redirect_back_or_default :action => "welcome" else flash.now['notice'] = "Login unsuccessful" @login = @params[:user_login] end end end |
#logout ⇒ Object
32 33 34 |
# File 'app/controllers/account_controller.rb', line 32 def logout @session[:user] = nil end |
#signup ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/account_controller.rb', line 21 def signup if @request.post? @user = User.new(@params[:user]) if @user.save @session[:user] = User.authenticate(@user.login, @params[:user][:password]) flash['notice'] = "Signup successful" redirect_back_or_default :action => "welcome" end end end |
#welcome ⇒ Object
36 37 |
# File 'app/controllers/account_controller.rb', line 36 def welcome end |