Skip to content

Commit 3d4dfbf

Browse files
committed
Trim and lowercase all
1 parent 5074eae commit 3d4dfbf

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/main/kotlin/de/tschuehly/htmx/spring/supabase/auth/controller/SupabaseUserController.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class SupabaseUserController(
5050
@ResponseBody
5151
fun anonSignInWithEmail(@RequestParam email: String?) {
5252
if (email != null) {
53-
supabaseUserService.signInAnonymouslyWithEmail(email)
53+
supabaseUserService.signInAnonymouslyWithEmail(email.trim().lowercase())
5454
} else {
5555
MissingCredentials.EMAIL_MISSING.throwExc()
5656
}
@@ -63,7 +63,7 @@ class SupabaseUserController(
6363
) {
6464
if (email != null) {
6565
logger.debug("User with the email $email is linking an Anonymous User")
66-
supabaseUserService.requestEmailChange(email)
66+
supabaseUserService.requestEmailChange(email.trim().lowercase())
6767
} else {
6868
MissingCredentials.EMAIL_MISSING.throwExc()
6969
}
@@ -75,7 +75,7 @@ class SupabaseUserController(
7575
) {
7676
if (email != null) {
7777
logger.debug("User with the email $email is trying to sign in with a Magic Link")
78-
supabaseUserService.signInWithMagicLink(email)
78+
supabaseUserService.signInWithMagicLink(email.trim().lowercase())
7979
} else {
8080
MissingCredentials.EMAIL_MISSING.throwExc()
8181
}
@@ -94,7 +94,7 @@ class SupabaseUserController(
9494
MissingCredentials.OTP_MISSING.throwExc()
9595
}
9696
logger.debug("User with the email $email is confirming an OTP")
97-
supabaseUserService.confirmEmailOtp(email!!, otp!!)
97+
supabaseUserService.confirmEmailOtp(email!!.trim().lowercase(), otp!!)
9898
}
9999

100100

@@ -113,7 +113,7 @@ class SupabaseUserController(
113113
MissingCredentials.PASSWORD_MISSING.throwExc()
114114

115115
else ->
116-
function(email.trim(), password.trim())
116+
function(email.trim().lowercase(), password.trim())
117117
}
118118
}
119119

@@ -150,12 +150,12 @@ class SupabaseUserController(
150150
email: String
151151
) {
152152
logger.debug("User with the email $email requested a password reset")
153-
supabaseUserService.sendPasswordRecoveryEmail(email)
153+
supabaseUserService.sendPasswordRecoveryEmail(email.trim().lowercase())
154154
}
155155

156156
@PostMapping("/updatePassword")
157157
@ResponseBody
158158
fun updatePassword(@RequestParam password: String) {
159-
supabaseUserService.updatePassword(password)
159+
supabaseUserService.updatePassword(password.trim())
160160
}
161161
}

0 commit comments

Comments
 (0)