fix: verify users account if google auth #477
This commit is contained in:
@@ -104,13 +104,17 @@
|
|||||||
|
|
||||||
const [regexUsernameMatch] = [...(authUser.email?.matchAll(/(.*)@/g) || [])];
|
const [regexUsernameMatch] = [...(authUser.email?.matchAll(/(.*)@/g) || [])];
|
||||||
|
|
||||||
|
const isGoogleAuth = !!authUser.app_metadata?.providers?.includes('google');
|
||||||
|
|
||||||
const { data: newProfileData, error } = await supabase
|
const { data: newProfileData, error } = await supabase
|
||||||
.from('profile')
|
.from('profile')
|
||||||
.insert({
|
.insert({
|
||||||
id: authUser.id,
|
id: authUser.id,
|
||||||
username: regexUsernameMatch[1] + `${new Date().getTime()}`,
|
username: regexUsernameMatch[1] + `${new Date().getTime()}`,
|
||||||
fullname: regexUsernameMatch[1],
|
fullname: regexUsernameMatch[1],
|
||||||
email: authUser.email
|
email: authUser.email,
|
||||||
|
is_email_verified: isGoogleAuth,
|
||||||
|
verified_at: isGoogleAuth ? new Date().toDateString() : undefined
|
||||||
})
|
})
|
||||||
.select();
|
.select();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user