Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d ' {"user": {"email":"EgorkZe@gmail.com","password":"1234"}}' http://127.0.0.1:3000/users/sign_in
- session = 654a8f9be39839e0eac5b06c7224d671;
- success = 1;
- user = {
- "authentication_token" = "<null>";
- "created_at" = "2014-04-10T08:54:28.813Z";
- email = "egorkze@gmail.com";
- id = 1;
- "server_id" = "<null>";
- "updated_at" = "2014-04-11T07:27:23.580Z";
- };
- class SessionsController < Devise::SessionsController
- skip_before_filter :verify_authenticity_token, only: [:show, :create, :edit, :update, :destroy]
- def create
- resource = warden.authenticate!(:scope => resource_name, :recall => "sessions#failure")
- sign_in(resource_name, resource)
- respond_to do | format |
- format.json { render :json => { :success => true, :user => resource ,:session => session['session_id']}, :status => 200 }
- end
- end
- def failure
- respond_to do | format |
- format.json { render :status => 401, :json => {:success => false, :errors => ["Login failed."]} }
- end
- end
- end
- -b "session=654a8f9be39839e0eac5b06c7224d671"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement