if (!emailValidator.isValid(email, null)) {
return "redirect:/?message=Invalid email. Try again";
}
// if the session has expired for a fb/tw registration (i.e. attempt is null), do not proceed - otherwise inconsistent data is stored
ProviderSignInAttempt attempt = (ProviderSignInAttempt) request.getAttribute(ProviderSignInAttempt.class.getName(), RequestAttributes.SCOPE_SESSION);
if (attempt != null) {
User user = userService.completeUserRegistration(email, username, names, attempt.getConnection(), loginAutomatically, receiveDailyDigest);
signInAdapter.signIn(user, (HttpServletResponse) request.getNativeResponse(), true);
} else if ("Persona".equals(type)){
User user = userService.completeUserRegistration(email, username, names, null, loginAutomatically, receiveDailyDigest);
signInAdapter.signIn(user, (HttpServletResponse) request.getNativeResponse(), true);
}