/** 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()); } }
/** Logout and clean the session. */ public static Result logout() { session().clear(); flash("success", "You've been logged out"); return redirect(controllers.routes.Application.login()); }