Secure.class not . Security.class yes .
Make changes to Secure.class. No, usually, in most cases this should be normal. But you have to extend the Security class. There are several methods in this class that need to be overridden to suit your application.
static boolean authenticate(String username, String password); static boolean check(String profile); static String connected(); static void onAuthenticated(); static void onDisconnect(); static void onDisconnected();
EDIT: After reading all the comments and understanding Joe's real need, here is part of the solution.
- Create a regular login page. You can do this by adding a protected dependency to your
dependencies.yml file. (Also run play dependencies ) - Extends
Security to override authentication method. - Also override the
onAuthenticate method to redirect to the yuor select page using redirect() - Create a new
loginbox.html tag in the tags folder. The code is inserted below. - Use the loginbox tag on your home page:
#{loginbox /}
It means:
- You will have a login window on the main page.
- When users authenticate, they will be redirected to the page of your choice.
- If the login fails, they will be redirected to the login page and will see errors there.
loginbox.html
#{form @authenticate()} <label>Login</label> <input type="text" name="username" maxlength="80"/> <label>Password</label> <input type="password" name="password" maxlength="80"/> <input type="submit" class="rounded" value="Se connecter" /> #{/form}
source share