Class: Admin::SessionsController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::SessionsController
- Defined in:
- app/controllers/admin/sessions_controller.rb
Overview
This controller handles the login/logout function of the site.
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
-
#new ⇒ Object
render new.rhtml.
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/admin/sessions_controller.rb', line 10 def create self.current_user = User.authenticate(params[:login], params[:password]) if logged_in? redirect_back_or_default(admin_galleries_url) flash[:notice] = "Logged in successfully" else flash[:notice] = "Login unsucessful" render :action => 'new' end end |
#destroy ⇒ Object
21 22 23 24 25 |
# File 'app/controllers/admin/sessions_controller.rb', line 21 def destroy reset_session flash[:notice] = "You have been logged out." redirect_back_or_default('/') end |
#new ⇒ Object
render new.rhtml
6 7 8 |
# File 'app/controllers/admin/sessions_controller.rb', line 6 def new @page_title = "Connection" end |