playframework-2.3

Play form verification

好久不见. 提交于 2020-01-06 15:52:11
问题 How to add validation in play form? Below is reset password form which expects user to enter password twice. @(tokenId: String, form: Form[ResetPassword])(implicit messages: play.api.i18n.Messages, request: RequestHeader) @main("Reset Password") { @helper.form(routes.Application.handleResetPassword(tokenId)) { @helper.inputText(form("password1")) @helper.inputText(form("password2")) <button type="submit">Submit</button> } } In above form, I would like to add validation that will check if

Why is the Unresolved Dependencies error with SecureSocial and Play 2.3.2?

一个人想着一个人 提交于 2020-01-05 11:38:43
问题 i'm writing a Play 2.3.2 application (using Java). In my project now i need to use secure social (master) module. But when i type the activator run command i get the following errors: [info] Resolving ws.securesocial#securesocial_2.11;1.0-SNAPSHOT ... [warn] module not found: ws.securesocial#securesocial_2.11;1.0-SNAPSHOT [warn] ==== local: tried [warn] /home/giacomo/.ivy2/local/ws.securesocial/securesocial_2.11/1.0-SNAPSHOT/ivys/ivy.xml [warn] ==== activator-local: tried [warn] file:/home

setting up environment variables in Play! framework

↘锁芯ラ 提交于 2020-01-05 06:39:07
问题 I am trying to get the Play! framework up and running. After I extracted Play! version 2.3.0 to C:\Play and adding that directory ( C:\Play ) to my path in 'Environment Variables' (separated form the other paths with a ;), I tried running it with the command "Play new foobar" and I keep getting the error "'Play' is not recognized as an internal or external command, operable program or batch file." I have looked at a few possible fixes to this on here Configuration Variables in Play! Framework

Play Framework submitting boolean values with checkbox?

痴心易碎 提交于 2020-01-04 05:05:15
问题 Using Play 2.3.x I am trying to understand how checkboxes are handled in forms. This question seems like an outdated solution for an older version of Play. I understand that checkbox info will only be posted if checked, but I've created a small sample app and no info is posted even if I check the boxes. Here is my sample "Hello World" application Model public static class Hello { @Required public String name; @Required @Min(1) @Max(100) public Integer repeat; public String color; public

Why I get “Application does not take parameters” using JSON Read with Play framework 2.3?

限于喜欢 提交于 2020-01-03 13:02:13
问题 I wanna write JSON validation for a few Scala model classes in Play framework 2.3x. I'm using JSON Reads to do that following the instructions (https://playframework.com/documentation/2.3.x/ScalaJsonCombinators). But I get "Application does not take parameters" error and I don't know how to fix this. Here is my code. package models import play.api.libs.json._ import play.api.libs.json.Reads._ import play.api.libs.functional.syntax._ import reactivemongo.bson.BSONObjectID import java.util.Date

Why I get “Application does not take parameters” using JSON Read with Play framework 2.3?

假装没事ソ 提交于 2020-01-03 13:02:10
问题 I wanna write JSON validation for a few Scala model classes in Play framework 2.3x. I'm using JSON Reads to do that following the instructions (https://playframework.com/documentation/2.3.x/ScalaJsonCombinators). But I get "Application does not take parameters" error and I don't know how to fix this. Here is my code. package models import play.api.libs.json._ import play.api.libs.json.Reads._ import play.api.libs.functional.syntax._ import reactivemongo.bson.BSONObjectID import java.util.Date

PlayFramework FakeRequest returns 400 error

╄→尐↘猪︶ㄣ 提交于 2020-01-02 08:15:07
问题 In routes: POST /login controllers.ApplicationCtrl.login() In Controller: def login = Action(parse.json) { implicit request => { val email = (request.body \ "email").as[String] val password = (request.body \ "password").as[String] Ok(Json.toJson( Map("status" -> "OK", "message" -> "%s created".format(email)) )) } In tests "login" in new WithApplication{ val request = route( FakeRequest( Helpers.POST, controllers.routes.ApplicationCtrl.login.url, FakeHeaders(Seq(CONTENT_TYPE -> Seq(

Publish asset files of play framework plugin

爱⌒轻易说出口 提交于 2020-01-01 19:42:09
问题 using publishTo in build.sbt file, it can be automation the publishing progress. But asset files( in public folder) does not packaged. how to package and publish asset files? 回答1: For locally publishing assets files , add this snippet in build.sbt file import play.PlayImport.PlayKeys._ packagedArtifacts in publishLocal := { val artifacts: Map[sbt.Artifact, java.io.File] = (packagedArtifacts in publishLocal).value val assets: java.io.File = (playPackageAssets in Compile).value artifacts +

Playframework with CSRF : “CSRF token not found in session”?

非 Y 不嫁゛ 提交于 2020-01-01 04:54:11
问题 I'm making a simple authentication system using Playframework with their built-in CSRF filter and Security.Authenticator system, but I'm facing a problem : When the user fill his login/password and submit enter, I have the following error : CSRF token not found in session I checked my form and the CSRF token is really present and correctly placed (inside the tag) Here is my routes : GET /login controllers.Authentication.login POST /login controllers.Authentication.authenticate And my

Scala Play 2.3.0 with Anorm - Can't use Pattern Matching (IntelliJ cannot resolve symbol Row)

ぐ巨炮叔叔 提交于 2019-12-31 07:09:10
问题 I am developing an application with Scala (2.11) and Play Framework (2.3.0) on IntelliJ IDEA. I'm using Anorm to retrieve data from my database (MySQL with MariaDB). Here is my first test application (it works): package controllers import play.api.mvc._ import play.api.db._ import anorm._ case class Client(id: Int, nom: String, prenom: String) object Application extends Controller { def index = Action { var result: List[(Int, String)] = List() val sqlQuery = SQL( """ select idClient,