예제 #1
0
 /** Handle login form submission. */
 public static Result authenticate() {
   Form<Login> loginForm = form(Login.class).bindFromRequest();
   if (loginForm.hasErrors()) {
     return badRequest(login.render(loginForm));
   } else {
     session("email", loginForm.get().email);
     return redirect(controllers.routes.Application.index());
   }
 }
예제 #2
0
 /** Logout and clean the session. */
 public static Result logout() {
   session().clear();
   flash("success", "You've been logged out");
   return redirect(controllers.routes.Application.login());
 }