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()); } }
public static Result logout() { session().clear(); flash("success", "You've been logged out"); return redirect(routes.Application.home()); }