Skip to content

Instantly share code, notes, and snippets.

@maiha
Created May 5, 2010 05:18
Show Gist options
  • Save maiha/390409 to your computer and use it in GitHub Desktop.
Save maiha/390409 to your computer and use it in GitHub Desktop.
def login_required(email: String, password: String) {
User.find("byEmail", email).first match {
case u:User if u.password == password =>
session.put("user", u.email)
Application.index
case u:User => render("reminder", u.email)
case _ => access_denied
}
}
def login_required
user = User.first(:email=>params[:email])
if user and user.password == params[:password]
return true
elsif user
render :partial=>"reminder", :locals=>{:email=>params[:email]}
return false
else
access_denied
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment