Guest User

Untitled

a guest
May 19th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. def signup(xhtml: NodeSeq): NodeSeq = {
  2. val user = new User
  3.  
  4. bind("f", xhtml,
  5. "firstName" -> SHtml.text(user.firstName, user.firstName = _),
  6. "lastName" -> SHtml.text(user.lastName, user.lastName = _),
  7. "nickName" -> SHtml.text(user.nickName, user.nickName = _),
  8. "password" -> SHtml.password("", user.password = _),
  9. "passwordConfirmation" -> SHtml.password("", user.passwordConfirmation = _),
  10. "send" -> SHtml.submit("Sign up", () => {
  11. user.register match {
  12. case Errors(e) => S.error(user.errors.fullMessages.map(e => <li>{e}</li>))
  13. case _ =>
  14. S.notice("User created")
  15. S.redirectTo("/")
  16. }
  17. })
  18. )
  19. }
Add Comment
Please, Sign In to add comment