Created
May 23, 2011 06:09
-
-
Save rossabaker/986303 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dailyLif | |
import org.scalatra._ | |
import scalate.ScalateSupport | |
import org.scalatra.scalate._ | |
class DailyLifUserFilter extends ScalatraFilter /* with DatabaseInit with DatabaseSessionSupport */ with CookieSupport with FlashMapSupport with ScalateSupport { | |
get("/user/login") { | |
contentType = "text/html" | |
templateEngine.layout("/WEB-INF/scalate/templates/login.ssp", Map("message" -> flash.getOrElse("message", ""))) | |
} | |
post("/user/login") { | |
(params("email"), params("password")) match { | |
case("", "") => { | |
flash("message") = "Please provide email and password to login" | |
redirect("/user/login") | |
} | |
case(email:String, password:String) => { | |
// other logic | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ val message: String %> | |
<form method="post"> | |
Message: ${message}<br /> | |
E-mail: <input type="text" name="email" /><br /> | |
Password: <input type="password" name="password" /><br /> | |
<input type="submit" value="Login" /> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment