Fixing registration redirect for new OpenID users

The redirect URL contains an extra # from the next token, which
results in a 404 when a user signs in for the first time using
OpenID. This fix removes the # from the token when generating
the registration redirect URL.

Change-Id: I059c8e860a8d54eefab8b1c4144a6b009cb7c322
This commit is contained in:
Brian O'Connor
2018-02-06 19:20:50 -08:00
parent ec89c1dd35
commit 40471df546

View File

@@ -488,10 +488,15 @@ class OpenIdServiceImpl {
final StringBuilder rdr = new StringBuilder();
rdr.append(urlProvider.get(req));
String nextToken = Url.decode(token);
if (isNew && !token.startsWith(PageLinks.REGISTER + "/")) {
rdr.append('#' + PageLinks.REGISTER);
if (nextToken.startsWith("#")) {
// Need to strip the leading # off the token to fix registration page redirect
nextToken = nextToken.substring(1);
}
}
rdr.append(Url.decode(token));
rdr.append(nextToken);
rsp.sendRedirect(rdr.toString());
}