Created
March 27, 2014 07:04
-
-
Save bhaskarkotu/9801903 to your computer and use it in GitHub Desktop.
sessions controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SessionsController < Devise::SessionsController | |
def create | |
respond_to do |format| | |
format.html { super } | |
format.json { | |
warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#new", | |
email: params[:email], password: params[:password]) | |
render :status => 200, :json => { :error => "Success" } | |
} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After loged in as admin@lf.com, again i tried to login using restclient with the same credentials of admin@lf.com. the following is the result.
Started POST "/users/sign_in?email=admin@lf.com&password=[FILTERED]" for 127.0.0.1 at 2014-03-27 12:52:34 +0530
Processing by SessionsController#create as /
Parameters: {"email"=>"admin@lf.com", "password"=>"[FILTERED]", "session"=>{}}
User Load (0.4ms) SELECT
users
.* FROMusers
WHEREusers
.id
= 1 ORDER BYusers
.id
ASC LIMIT 1Redirected to http://localhost:3000/
Filter chain halted as :require_no_authentication rendered or redirected
Completed 302 Found in 3ms (ActiveRecord: 0.4ms)