Created
August 23, 2011 19:42
Revisions
-
joslynesser revised this gist
Aug 24, 2011 . 2 changed files with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1 +1,4 @@ POST /user_sessions.json { "email": "[email protected]", "password": "somepassword" } => { "user_credentials": "123abc" } GET /case_filters/1/cases.json?user_credentials=123abc => [ ...cases ... ] This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,8 @@ class Api::V2::UserSessionsController < Api::V2::BaseController # Check to ensure request came from an assistly application (mobile/api console/etc) before_filter :assistly_client_application_required, :only => :create def create @user_session = UserSession.new(params[:user_session]) -
joslynesser revised this gist
Aug 23, 2011 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ GET /case_filters/1/cases.json?user_credentials=123abc -
joslynesser created this gist
Aug 23, 2011 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ class UserSession < Authlogic::Session::Base single_access_allowed_request_types :any before_create :reset_single_access_token end This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ class Api::V2::UserSessionsController < Api::V2::BaseController def create @user_session = UserSession.new(params[:user_session]) if @user_session.save render :json => { :success => true, :user_credentials => @user_session.user.single_access_token } else render :json => { :success => false, :message => "Invalid Login" }, :status => :unauthorized end end end