Sha256: 5912f3908c5008b5ce2f7e5b0908beac031166a46af69769cb8107e428845d03

Contents?: true

Size: 778 Bytes

Versions: 5

Compression:

Stored size: 778 Bytes

Contents

class SessionController < BaseController
  renders_with_error_proc :below_field

  skip_before_action :verify_authenticity_token # disable forgery protection

  layout 'login'

  def new
    @user = User.new
  end

  def create
    if authenticate_user(params[:user])
      remember_me! if params[:user][:remember_me]
      flash[:notice] = t(:'adva.session.flash.create.success')
      redirect_to return_from(:login)
    else
      @user = User.new(:email => params[:user][:email])
      @remember_me = params[:user][:remember_me]
      flash.now[:error] = t(:'adva.session.flash.create.failure')
      render :action => 'new'
    end
  end

  def destroy
    logout
    flash[:notice] = t(:'adva.session.flash.destroy.success')
    redirect_to return_from(:logout)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
adva-0.1.4 app/controllers/session_controller.rb
adva-0.1.3 app/controllers/session_controller.rb
adva-0.1.2 app/controllers/session_controller.rb
adva-0.1.1 app/controllers/session_controller.rb
adva-0.1.0 app/controllers/session_controller.rb