Sha256: 7685fcc476a093317a7effe0e54ec6a9eba798a1b4d3804ccb059d71d1d8badc
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
module Incline ## # A simple controller providing the login and logout methods for the application. class SessionsController < ApplicationController # must be anon to login. require_anon :new, :create # don't raise an error if anon tries to logout. allow_anon true ## # GET /incline/login def new end ## # POST /incline/login 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 root_url end else # deny login. flash.now[:danger] = 'Invalid email or password.' render 'new' end end ## # DELETE /incline/logout def destroy log_out if logged_in? redirect_to root_url end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
incline-0.1.7 | app/controllers/incline/sessions_controller.rb |
incline-0.1.5 | app/controllers/incline/sessions_controller.rb |