Created
July 2, 2016 17:25
-
-
Save hugueslamy/c260a2d78195936606fefcb1616d27fd to your computer and use it in GitHub Desktop.
Snippet of code to manually connect Devise without going to warden strategies.
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
def create | |
resource = User.find_for_database_authentication(email: params[:user][:email]) | |
return invalid_login_attempt unless resource | |
if resource.valid_password?(params[:user][:password]) | |
sign_in :user, resource | |
return render nothing: true | |
end | |
invalid_login_attempt | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment