Class: AccountController

Inherits:
ApplicationController show all
Includes:
LoginSystem
Defined in:
app/controllers/account_controller.rb

Instance Method Summary collapse

Instance Method Details

#loginObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/account_controller.rb', line 6

def 
  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

#logoutObject



32
33
34
# File 'app/controllers/account_controller.rb', line 32

def logout
  @session[:user] = nil
end

#signupObject



21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/account_controller.rb', line 21

def 
  if @request.post? 
      @user = User.new(@params[:user])
      if @user.save
          @session[:user] = User.authenticate(@user., @params[:user][:password])
          flash['notice']  = "Signup successful"
          redirect_back_or_default :action => "welcome"
      end      
  end
end

#welcomeObject



36
37
# File 'app/controllers/account_controller.rb', line 36

def welcome
end