我正在尝试在我的应用程序中添加一个登录/授权包装器,但事实证明这很困难。
目前我收到以下错误
Submission.scala的代码在
之下package controllers
import play.api._
import play.api.mvc._
import play.api.data._
import play.api.data.Forms._
import anorm._
import views._
import models._
object Submission extends Controller with Secured {
val contactForm:Form[Contact] = Form(
mapping(
"title" -> text,
"firstname" -> text,
"lastname" -> text,
"gender" -> text,
"dob" -> text,
"mobile" -> text,
"landline" -> text,
"email" -> text,
"housenumber1" -> text,
"housename1" -> text,
"address11" -> text,
"address12" -> text,
"address13" -> text,
"address14" -> text,
"address15" -> text,
"postcode1" -> text,
"country1" -> text )
(Contact.apply)(Contact.unapply)
)
def submit = TODO
//def index = Action {
//Ok(html.application());
//}
def index = IsAuthenticated { username => _ =>
User.findByEmail(username).map { user =>
Ok(
html.index.apply()
)
}.getOrElse(Forbidden)
def form = Action {
Ok(html.application(contactForm))
}
//def submit = Action { implicit request =>
//val (fname, lname) = form.bindFromRequest.get
//Ok("Hi %s %s".format(fname, lname))
//}
}
}
我试图从Play的samples文件夹中的zentasks demo中复制相关部分,但我似乎错过了一些东西。我是Play和Scala的新手,所以错误可能很简单。
非常感谢任何建议。
由于