示例#1
0
 public static Result authenticate() {
   Form<Login> loginForm = Form.form(Login.class).bindFromRequest();
   if (loginForm.hasErrors()) {
     return badRequest(login.render(loginForm));
   } else {
     session().clear();
     session("email", loginForm.get().email);
     return redirect(routes.Application.home());
   }
 }
示例#2
0
 public static Result logout() {
   session().clear();
   flash("success", "You've been logged out");
   return redirect(routes.Application.home());
 }