if (authenticatedAccount != null
&& authenticatedAccount.isEnabled()) {
credentials.setUsername(authenticatedAccount.getUsername());
Identity.instance().acceptExternallyAuthenticatedPrincipal(
(new OpenIdPrincipal(result.getAuthenticatedId())));
this.loginImmediate();
}
// If the user hasn't been registered yet
else if (authenticatedAccount == null) {
credentials.setUsername(result.getAuthenticatedId()); // this is