Allow empty email
This commit is contained in:
@@ -196,7 +196,7 @@ func UpdateProfileResolver(ctx context.Context, params model.UpdateProfileInput)
|
||||
|
||||
hasEmailChanged := false
|
||||
|
||||
if params.Email != nil && user.Email != refs.StringValue(params.Email) {
|
||||
if params.Email != nil && refs.StringValue(user.Email) != refs.StringValue(params.Email) {
|
||||
// check if valid email
|
||||
if !validators.IsValidEmail(*params.Email) {
|
||||
log.Debug("Failed to validate email: ", refs.StringValue(params.Email))
|
||||
@@ -220,7 +220,7 @@ func UpdateProfileResolver(ctx context.Context, params model.UpdateProfileInput)
|
||||
go memorystore.Provider.DeleteAllUserSessions(user.ID)
|
||||
go cookie.DeleteSession(gc)
|
||||
|
||||
user.Email = newEmail
|
||||
user.Email = &newEmail
|
||||
isEmailVerificationDisabled, err := memorystore.Provider.GetBoolStoreEnvVariable(constants.EnvKeyDisableEmailVerification)
|
||||
if err != nil {
|
||||
log.Debug("Failed to get disable email verification env variable: ", err)
|
||||
@@ -257,7 +257,7 @@ func UpdateProfileResolver(ctx context.Context, params model.UpdateProfileInput)
|
||||
}
|
||||
|
||||
// exec it as go routine so that we can reduce the api latency
|
||||
go email.SendEmail([]string{user.Email}, verificationType, map[string]interface{}{
|
||||
go email.SendEmail([]string{refs.StringValue(user.Email)}, verificationType, map[string]interface{}{
|
||||
"user": user.ToMap(),
|
||||
"organization": utils.GetOrganization(),
|
||||
"verification_url": utils.GetEmailVerificationURL(verificationToken, hostname, redirectURL),
|
||||
|
Reference in New Issue
Block a user