use of org.mamute.auth.SocialAPI in project mamute by caelum.
the class FacebookAuthController method signupViaFacebook.
@Get("/sign-up/facebook/")
public void signupViaFacebook(String code, String state) {
if (code == null) {
includeAsList("mamuteMessages", i18n("error", "error.signup.facebook.unknown"));
redirectTo(SignupController.class).signupForm();
return;
}
Token token = service.getAccessToken(null, new Verifier(code));
SocialAPI facebookAPI = new FacebookAPI(service, token);
boolean success = loginManager.merge(MethodType.FACEBOOK, facebookAPI);
if (!success) {
includeAsList("mamuteMessages", i18n("error", "signup.errors.facebook.invalid_email", state));
result.redirectTo(AuthController.class).loginForm(state);
return;
}
redirectToRightUrl(state);
}
use of org.mamute.auth.SocialAPI in project mamute by caelum.
the class GoogleAuthController method signUpViaGoogle.
@Get("/sign-up/google/")
public void signUpViaGoogle(String state, String code) {
Token token = service.getAccessToken(null, new Verifier(code));
SocialAPI googleAPI = new GoogleAPI(token, service);
loginManager.merge(MethodType.GOOGLE, googleAPI);
redirectToRightUrl(state);
}