Created
October 17, 2011 18:46
-
-
Save GarthDB/1293429 to your computer and use it in GitHub Desktop.
user login
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 UsersController < ApplicationController | |
def login | |
error = false; | |
@user = User.find_by_email(params['email']); | |
if(@user.nil?) | |
error = true | |
else | |
error = [email protected]_password?(params['password']) | |
end | |
error_response = {:response => 'Error', :message => 'Not a valid email/password'} | |
respond_to do |format| | |
if(error) | |
format.json { render :json => error_response, :status=> 401} | |
else | |
format.json { render :json => @user} | |
end | |
end | |
end | |
def index | |
end | |
def new | |
end | |
def create | |
end | |
def edit | |
end | |
def update | |
end | |
def destroy | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment