Sha256: 13aad6ae3099fe299398f395262ae1b05cff7153e003ee399867c3a3e53b6df3

Contents?: true

Size: 730 Bytes

Versions: 8

Compression:

Stored size: 730 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]
      redirect_to return_from(:login), notice: "Logged in successfully."
    else
      @user = User.new(:email => params[:user][:email])
      @remember_me = params[:user][:remember_me]
      flash.now.alert = "Could not login with this email and password."
      render :action => 'new'
    end
  end

  def destroy
    logout
    redirect_to return_from(:logout), notice: "Logged out successfully."
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
adva-0.3.2 app/controllers/session_controller.rb
adva-0.3.1 app/controllers/session_controller.rb
adva-0.3.0 app/controllers/session_controller.rb
adva-0.2.4 app/controllers/session_controller.rb
adva-0.2.3 app/controllers/session_controller.rb
adva-0.2.2 app/controllers/session_controller.rb
adva-0.2.1 app/controllers/session_controller.rb
adva-0.2.0 app/controllers/session_controller.rb