Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def signin = {
- def errors = []
- if (params.email && params.password)
- {
- def user = User.findByEmail(params.email)
- if (user)
- {
- if (user.password != params.password.encodeAsMD5())
- {
- errors.add("Incorrect password.")
- }
- }
- else
- {
- errors.add("No user matched.")
- }
- }
- else
- {
- errors.add("Please enter your e-mail and password.")
- }
- if (errors.size() == 0)
- {
- println user
- redirect("/")
- }
- else
- {
- render(view:'login', model:[errors:errors])
- }
- }
Add Comment
Please, Sign In to add comment