Skip to content

Instantly share code, notes, and snippets.

@tylerjohnst
Created June 9, 2016 19:33
Show Gist options
  • Save tylerjohnst/b048ec0d7b9eda617d4d8aea77b1886f to your computer and use it in GitHub Desktop.
Save tylerjohnst/b048ec0d7b9eda617d4d8aea77b1886f to your computer and use it in GitHub Desktop.
def create
@user = User.find_by_email params[:email]
if @user && @user.valid_password?(password)
return redirect_to_oauth_complete(@user.account) if oauth_session?
sign_in @user
redirect_to [:dashboard]
else
flash[:error] = 'You have entered an invalid email or password. Please try again.'
render :new
flash.clear
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment