File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
adminforth/plugins/open-signup Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 3838 <div class =" p-4 md:p-5" >
3939 <form v-if =" !requestSent" class =" space-y-4" role =" alert" @submit.prevent >
4040 <div v-if =" !verifyToken" class =" relative" >
41- <label for =" email" class =" block mb-2 text-sm font-medium text-gray-900 dark:text-white" >{{$t('Your email')}}</label >
41+ <label for =" email" class =" block mb-2 text-sm font-medium text-gray-900 dark:text-white" >{{$t('Your email address ')}}</label >
4242 <input type =" email" name =" email" id =" email"
4343 tabindex =" 1"
4444 autocomplete =" username"
5050 />
5151 </div >
5252 <div v-if =" isPasswordNeeded" class =" relative" >
53- <label for =" password" class =" block mb-2 text-sm font-medium text-gray-900 dark:text-white" >{{$t('New password')}}</label >
53+ <label for =" password" class =" block mb-2 text-sm font-medium text-gray-900 dark:text-white" >{{$t('Your password')}}</label >
5454 <input
5555 tabindex =" 2"
5656 autocomplete =" new-password"
7474 </div >
7575
7676 <div v-if =" isPasswordNeeded" class =" relative" >
77- <label for =" password_confirmation" class =" block mb-2 text-sm font-medium text-gray-900 dark:text-white" >{{$t('Confirm new password')}}</label >
77+ <label for =" password_confirmation" class =" block mb-2 text-sm font-medium text-gray-900 dark:text-white" >{{$t('Confirm your password')}}</label >
7878 <input
7979 ref =" passwordConfirmationInput"
8080 autocomplete =" new-password"
Original file line number Diff line number Diff line change @@ -228,8 +228,10 @@ export default class OpenSignupPlugin extends AdminForthPlugin {
228228 }
229229 }
230230
231+ const normalizedEmail = email . toLowerCase ( ) ; // normalize email
232+
231233 // first check again if email already exists
232- const existingUser = await this . adminforth . resource ( this . authResource . resourceId ) . get ( Filters . EQ ( this . emailField . name , email ) ) ;
234+ const existingUser = await this . adminforth . resource ( this . authResource . resourceId ) . get ( Filters . EQ ( this . emailField . name , normalizedEmail ) ) ;
233235 if ( ( ! this . options . confirmEmails && existingUser ) || ( this . options . confirmEmails && existingUser ?. [ this . emailConfirmedField . name ] ) ) {
234236 return { error : tr ( 'Email already exists' , 'opensignup' ) , ok : false } ;
235237 }
@@ -239,7 +241,7 @@ export default class OpenSignupPlugin extends AdminForthPlugin {
239241 const created = await this . adminforth . resource ( this . authResource . resourceId ) . create ( {
240242 ...( this . options . defaultFieldValues || { } ) ,
241243 ...( this . options . confirmEmails ? { [ this . options . confirmEmails . emailConfirmedField ] : false } : { } ) ,
242- [ this . emailField . name ] : email ,
244+ [ this . emailField . name ] : normalizedEmail ,
243245 [ this . options . passwordHashField ] : password ? await AdminForth . Utils . generatePasswordHash ( password ) : '' ,
244246 } ) ;
245247 }
You can’t perform that action at this time.
0 commit comments