Skip to content

Instantly share code, notes, and snippets.

@carloncarpio
Created August 15, 2012 05:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save carloncarpio/3356351 to your computer and use it in GitHub Desktop.
Save carloncarpio/3356351 to your computer and use it in GitHub Desktop.
def attempt_login
authorized_user = User.authenticate(params[:username], params[:hashed_password])
if authorized_user
redirect_to(:action => 'index')
else
redirect_to(:action => 'login')
end
end
def self.authenticate(username="",password="")
user = User.find_by_username(username)
if user && user.hashed_password == password
return user
else
return false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment