kaize/deadline_camp

View on GitHub
app/controllers/web/admin/sessions_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Web::Admin::SessionsController < Web::Admin::BaseApplicationController
  def new
    @user = User.new
  end

  def create
    @user = User.find_by_email(params[:user][:email])
    if @user && @user.authenticate(params[:user][:password])
      user_sign_in(@user)
      redirect_to admin_root_path
    else
      @user = User.new(params[:user])
      flash.now[:error] = flash_translate(:authenticate_error)
      render :action => :new
    end
  end

  def destroy
    user_sign_out
    redirect_to :root
  end
end