joscha / play-authenticate

An authentication plugin for Play Framework 2.x (Java)
http://joscha.github.com/play-authenticate/
Other
807 stars 366 forks source link

"AskSignup" enhancement to confirm Terms of Services before a user is created #150

Open cnmuc opened 10 years ago

cnmuc commented 10 years ago

Hi joscha, I'd like to show a page where a user confirms my "terms of services" after an external provider (e.g., Google) redirects to my application and before the user gets signed up. My first idea was to do it similar as askMerge/askLink, something like (PlayAuthenticate.java):

...
else if (!isLoggedIn) {
    if (isAccountAutoSignup()) {
        loginUser = signupUser(newUser, session, ap);
    } else {
        final Call c = getResolver().askSignup();
        if (c == null) {
            throw new RuntimeException(
                    Messages.get(
                            "playauthenticate.core.exception.signup.controller_undefined",
                            SETTING_KEY_ACCOUNT_AUTO_SIGNUP));
        }
        storeSignupUser(newUser, session);
        return Controller.redirect(c);
    }
}
...

Should I provide a changeset with this implementation? Do you have any other idea how to do it?

joscha commented 10 years ago

@cnmuc seems as if this is something that we could actually implement generically with an interceptor, that can be implemented - link and merge would just be two specific implementations then - and you would have a specific TOS implementation of it - if you would be willing to contribute that, that'd quite cool!