Class: Admin::WelcomeController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/admin/welcome_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



5
6
7
# File 'app/controllers/admin/welcome_controller.rb', line 5

def index
  redirect_to admin_pages_url
end

#loginObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/admin/welcome_controller.rb', line 9

def 
  if request.post?
    @username_or_email = params[:username_or_email]
    password = params[:password]
    announce_invalid_user unless self.current_user = User.authenticate(@username_or_email, password)
  end
  if current_user
    if params[:remember_me]
      current_user.remember_me
      set_session_cookie
    end
    redirect_to (session[:return_to] || welcome_url)
    session[:return_to] = nil
  end
end

#logoutObject



25
26
27
28
29
30
31
# File 'app/controllers/admin/welcome_controller.rb', line 25

def logout
  cookies[:session_token] = { :expires => 1.day.ago }
  self.current_user.forget_me if self.current_user
  self.current_user = nil
  announce_logged_out
  redirect_to 
end