Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- object isLoggedIn extends SessionVar[Boolean](false)
- class Login {
- def login(xhtml: NodeSeq): NodeSeq = {
- if(isLoggedIn) S.redirectTo("/")
- var username = ""
- var password = ""
- bind("f", xhtml,
- "username" -%> SHtml.text("", username = _),
- "password" -%> SHtml.text("", password = _),
- "send" -%> SHtml.submit("Login", () => {
- // Mate.authenticate(username.get, password.get) TODO: Do REAL authentication
- if(username == "teamon"){
- isLoggedIn.set(true)
- } else {
- S.error("Wrong password")
- S.redirectTo("/login")
- }
- })
- )
- }
- }
Add Comment
Please, Sign In to add comment