Skip to content

Commit

Permalink
Merge pull request #801 from supertokens/rename-userid
Browse files Browse the repository at this point in the history
fix: rename userId to recipeUserId
  • Loading branch information
porcellus authored Sep 13, 2023
2 parents 1971c2c + 3bdc244 commit b785061
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import io.supertokens.pluginInterface.passwordless.exception.DuplicatePhoneNumberException;
import io.supertokens.pluginInterface.thirdparty.exception.DuplicateThirdPartyUserException;
import io.supertokens.useridmapping.UserIdType;
import io.supertokens.utils.SemVer;
import io.supertokens.webserver.InputParser;
import io.supertokens.webserver.WebserverAPI;
import jakarta.servlet.ServletException;
Expand All @@ -56,7 +57,13 @@ public String getPath() {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
JsonObject input = InputParser.parseJsonObjectOrThrowError(req);
String userId = InputParser.parseStringOrThrowError(input, "userId", false);
String userId;

if (getVersionFromRequest(req).lesserThan(SemVer.v4_0)) {
userId = InputParser.parseStringOrThrowError(input, "userId", false);
} else {
userId = InputParser.parseStringOrThrowError(input, "recipeUserId", false);
}
// normalize userId
userId = userId.trim();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ public String getPath() {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
JsonObject input = InputParser.parseJsonObjectOrThrowError(req);
String userId = InputParser.parseStringOrThrowError(input, "userId", false);
String userId;

if (getVersionFromRequest(req).lesserThan(SemVer.v4_0)) {
userId = InputParser.parseStringOrThrowError(input, "userId", false);
} else {
userId = InputParser.parseStringOrThrowError(input, "recipeUserId", false);
}
// normalize userId
userId = userId.trim();

Expand Down

0 comments on commit b785061

Please sign in to comment.