Created
August 9, 2013 20:57
-
-
Save abhishek0/6197125 to your computer and use it in GitHub Desktop.
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 characters
class LoginController < ApplicationController | |
skip_before_filter :check_authentication, :only => :index | |
def index | |
user = User.find_by_email(params[:email]) | |
if user && user.authenticate(params[:password]) | |
respond_with user | |
else | |
render | |
end | |
#(user and user.authenticate(params[:password])) ? respond_with(user) : not_found | |
end | |
private | |
def login_params | |
params.require(:login).permit(:email, :password) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment