Guest User

Untitled

a guest
May 18th, 2018
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. object isLoggedIn extends SessionVar[Boolean](false)
  2.  
  3. class Login {
  4. def login(xhtml: NodeSeq): NodeSeq = {
  5. if(isLoggedIn) S.redirectTo("/")
  6.  
  7. var username = ""
  8. var password = ""
  9.  
  10. bind("f", xhtml,
  11. "username" -%> SHtml.text("", username = _),
  12. "password" -%> SHtml.text("", password = _),
  13. "send" -%> SHtml.submit("Login", () => {
  14. // Mate.authenticate(username.get, password.get) TODO: Do REAL authentication
  15. if(username == "teamon"){
  16. isLoggedIn.set(true)
  17. } else {
  18. S.error("Wrong password")
  19. S.redirectTo("/login")
  20. }
  21. })
  22. )
  23. }
  24. }
Add Comment
Please, Sign In to add comment