Implement sessions/create in JSON API

This commit is contained in:
Thibault Jouan
2012-02-26 11:16:52 +00:00
parent 499b06c9e5
commit 5dfafdcc46
6 changed files with 103 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
class Api::V0::SessionsController < Api::ApplicationController
skip_before_filter :authenticate!, :only => [:create]
def create
user = User.find_by_email(params[:session][:email])
if ! user.try(:authenticate?, params[:session][:password])
return render :json => '', :status => :not_found
end
@user = user
self.current_user = @user
end
end