Class: Authorizme::SessionsController

Inherits:
AuthorizmeController show all
Defined in:
app/controllers/authorizme/sessions_controller.rb

Instance Method Summary collapse

Methods inherited from AuthorizmeController

#index

Instance Method Details

#createObject



4
5
6
7
8
9
10
11
12
# File 'app/controllers/authorizme/sessions_controller.rb', line 4

def create
  user = User.find(:first, :conditions => [ "lower(email) = ?", params[:email].downcase ])
  if user && user.authenticate(params[:password])
     user
    respond_with({status: "logged_in", user: user}, :location => Authorizme::)
  else
    respond_with({status: "authorization_faild", user: user}, {:location => Authorizme::not_logged_in_path, :status => :not_found})
  end
end

#destroyObject



14
15
16
# File 'app/controllers/authorizme/sessions_controller.rb', line 14

def destroy
  logout
end