-
-
Save bhaskarkotu/9801903 to your computer and use it in GitHub Desktop.
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 |
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
.* FROM users
WHERE users
.id
= 1 ORDER BY users
.id
ASC LIMIT 1
Redirected to http://localhost:3000/
Filter chain halted as :require_no_authentication rendered or redirected
Completed 302 Found in 3ms (ActiveRecord: 0.4ms)
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
.* FROM users
WHERE users
.id
= 1 ORDER BY users
.id
ASC LIMIT 1
Redirected to http://localhost:3000/
Filter chain halted as :require_no_authentication rendered or redirected
Completed 302 Found in 3ms (ActiveRecord: 0.4ms)
Started POST "/users/sign_in?email=admin@lf.com&password=[FILTERED]" for 127.0.0.1 at 2014-03-27 12:44:13 +0530
Processing by SessionsController#create as /
Parameters: {"email"=>"admin@lf.com", "password"=>"[FILTERED]", "session"=>{}}
resource name:user
controller_path: sessions#new
admin@lf.com
12345
Completed 401 Unauthorized in 1ms
Processing by SessionsController#new as /
Parameters: {"email"=>"admin@lf.com", "password"=>"[FILTERED]", "session"=>{}}
Rendered devise/shared/_links.erb (0.3ms)
Rendered devise/sessions/new.html.erb within layouts/application (2.8ms)
Completed 200 OK in 42ms (Views: 29.2ms | ActiveRecord: 1.5ms)