Exemplo n.º 1
0
 /** Login page. */
 public static Result login() {
   String user = session("email");
   if (user != null) {
     return redirect(routes.JobOffers.index());
   } else {
     return ok(login.render(form(Application.Login.class)));
   }
 }
Exemplo n.º 2
0
 /** Handle login form submission. */
 public static Result authenticate() {
   Form<Login> filledLogin = form(Application.Login.class).bindFromRequest();
   if (filledLogin.hasErrors()) {
     return badRequest(login.render(filledLogin));
   } else {
     session("email", filledLogin.get().email);
     return redirect(routes.JobOffers.index());
   }
 }