Advertisement
Guest User

I will kill this shit...

a guest
Jun 19th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.72 KB | None | 0 0
  1. val formUser = Form(
  2.     mapping(
  3.       "username" -> nonEmptyText,
  4.       "password" -> nonEmptyText,
  5.       "role" -> nonEmptyText
  6.     )(UserFormData.apply)(UserFormData.unapply)
  7.   )
  8.  
  9.   def submit = actionBuilder.RestrictAction("admin").defaultHandler() { implicit authRequest => Future {
  10.     //Read fields from form
  11.     // in theory should work
  12.       formUser.bindFromRequest.fold(
  13.         errorForm => Ok(views.html.form(errorForm)),
  14.       data => usersRepository.addNewUser(5, username=String, password = String, role = String)
  15.       )
  16.       Redirect(routes.UsersController.listUsers())
  17. //      usersRepository.addNewUser(5, "gupia", "kuhwa", "scala");
  18. //      Redirect(routes.UsersController.listUsers())
  19.     }
  20.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement