Module: Revise::Helpers::Authentication

Defined in:
lib/revise/helpers/authentication.rb

Instance Method Summary collapse

Instance Method Details

#authenticateObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/revise/helpers/authentication.rb', line 4

def authenticate()
  if  = Account.authenticate(params[:email], params[:password])
    ()
    redirect url(:main, :index)
  elsif Padrino.env == :development && params[:bypass] || Padrino.env == :test && params[:bypass]
     = Account.find_by_email(params[:email])
    halt 400, "Email does not exist." unless 
    ()
    redirect url(:main, :index)
  else
    params[:email], params[:password] = h(params[:email]), h(params[:password])
    flash[:warning] = "Login or password wrong."
    redirect url(:sessions, :new)
  end
end