diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b072c924..d14249006 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,9 +20,13 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - `POST /recipe/totp/device/verify` to verify a device. This is to ensure that the user has access to the device. - `POST /recipe/totp/verify` to verify a code and continue the login flow. - `PUT /recipe/totp/device` to update the name of a device. Name is just a string that the user can set to identify the device. -- `GET /recipe/totp/device/list` to get all devices for a user. +- `GET /recipe/totp/device/list` to get all devices for a user. - `POST /recipe/totp/device/remove` to remove a device. If the user has no more devices, the user is also removed. +## [4.4.2] - 2023-03-16 + +- Adds null check in email normalisation to fix: https://github.com/supertokens/supertokens-node/issues/514 + ## [4.4.1] - 2023-03-09 - Normalises email in all APIs in which email was not being diff --git a/build.gradle b/build.gradle index 816c6aa1e..bd5bbbc95 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ compileTestJava { options.encoding = "UTF-8" } // } //} -version = "4.4.1" +version = "4.4.2" repositories { diff --git a/cli/jar/cli.jar b/cli/jar/cli.jar index 4ddc8cf20..e86139f4b 100644 Binary files a/cli/jar/cli.jar and b/cli/jar/cli.jar differ diff --git a/downloader/jar/downloader.jar b/downloader/jar/downloader.jar index fd3ae1f44..e669c59a8 100644 Binary files a/downloader/jar/downloader.jar and b/downloader/jar/downloader.jar differ diff --git a/ee/jar/ee.jar b/ee/jar/ee.jar index bd74e44f4..f332e6617 100644 Binary files a/ee/jar/ee.jar and b/ee/jar/ee.jar differ diff --git a/jar/core-4.4.1.jar b/jar/core-4.4.2.jar similarity index 90% rename from jar/core-4.4.1.jar rename to jar/core-4.4.2.jar index 6fc215cca..aa7c0a42e 100644 Binary files a/jar/core-4.4.1.jar and b/jar/core-4.4.2.jar differ diff --git a/src/main/java/io/supertokens/utils/Utils.java b/src/main/java/io/supertokens/utils/Utils.java index cf31c3c51..3dbcca88f 100644 --- a/src/main/java/io/supertokens/utils/Utils.java +++ b/src/main/java/io/supertokens/utils/Utils.java @@ -16,18 +16,16 @@ package io.supertokens.utils; -import javax.crypto.*; -import javax.crypto.spec.GCMParameterSpec; -import javax.crypto.spec.PBEKeySpec; -import javax.crypto.spec.SecretKeySpec; - import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; - import io.supertokens.session.accessToken.AccessTokenSigningKey.KeyInfo; +import javax.crypto.*; +import javax.crypto.spec.GCMParameterSpec; +import javax.crypto.spec.PBEKeySpec; +import javax.crypto.spec.SecretKeySpec; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.math.BigInteger; @@ -39,14 +37,17 @@ import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; import java.util.Base64; -import java.util.List; import java.util.Base64.Decoder; import java.util.Base64.Encoder; +import java.util.List; import java.util.UUID; public class Utils { public static String normaliseEmail(String email) { + if (email == null) { + return null; + } // we assume that the email's syntax is correct here. // as per https://github.com/supertokens/supertokens-core/issues/89 and diff --git a/src/test/java/io/supertokens/test/emailpassword/api/UserPutAPITest2_8.java b/src/test/java/io/supertokens/test/emailpassword/api/UserPutAPITest2_8.java index 58913e7d6..f0b0f8bab 100644 --- a/src/test/java/io/supertokens/test/emailpassword/api/UserPutAPITest2_8.java +++ b/src/test/java/io/supertokens/test/emailpassword/api/UserPutAPITest2_8.java @@ -155,6 +155,32 @@ public void testSuccessfulUpdate() throws Exception { assertEquals("OK", response.get("status").getAsString()); assertEquals(1, response.entrySet().size()); + + EmailPassword.signIn(process.main, "someotheremail@gmail.com", "somePass"); + }); + } + + @Test + public void testSuccessfulUpdateWithOnlyPassword() throws Exception { + TestingProcessManager.withProcess(process -> { + if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { + return; + } + + UserInfo user = EmailPassword.signUp(process.getProcess(), "someemail@gmail.com", "somePass"); + + JsonObject body = new JsonObject(); + body.addProperty("userId", user.id); + body.addProperty("password", "somePass123"); + + JsonObject response = HttpRequestForTesting.sendJsonPUTRequest(process.getProcess(), "", + "http://localhost:3567/recipe/user", body, 1000, 1000, null, Utils.getCdiVersion2_8ForTests(), + RECIPE_ID.EMAIL_PASSWORD.toString()); + + assertEquals("OK", response.get("status").getAsString()); + assertEquals(1, response.entrySet().size()); + + EmailPassword.signIn(process.main, "someemail@gmail.com", "somePass123"); }); }