Class: Incline::SessionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Incline::SessionsController
- Defined in:
- app/controllers/incline/sessions_controller.rb
Overview
A simple controller providing the login and logout methods for the application.
Instance Method Summary collapse
-
#create ⇒ Object
POST /incline/login.
-
#destroy ⇒ Object
DELETE /incline/logout.
-
#new ⇒ Object
GET /incline/login.
Instance Method Details
#create ⇒ Object
POST /incline/login
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/incline/sessions_controller.rb', line 19 def create if (@user = Incline::UserManager.authenticate(params[:session][:email], params[:session][:password], request.remote_ip)) if @user.activated? # log the user in. log_in @user params[:session][:remember_me] == '1' ? remember(@user) : forget(@user) # show alerts on login. session[:show_alerts] = true redirect_back_or @user else flash[:safe_warning] = 'Your account has not yet been activated.<br/>Check your email for the activation link.' redirect_to main_app.root_url end else # deny login. flash.now[:danger] = 'Invalid email or password.' render 'new' end end |
#destroy ⇒ Object
DELETE /incline/logout
43 44 45 46 |
# File 'app/controllers/incline/sessions_controller.rb', line 43 def destroy log_out if logged_in? redirect_to main_app.root_url end |
#new ⇒ Object
GET /incline/login
14 15 |
# File 'app/controllers/incline/sessions_controller.rb', line 14 def new end |