check-not-basic
All checks were successful
deploy / deploy (push) Successful in 1m35s

This commit is contained in:
Untone 2024-02-08 18:54:44 +03:00
parent 7bc9fca4c4
commit 42efbc232b

View File

@ -33,18 +33,21 @@ func IsRegisteredResolver(ctx context.Context, email string) (*model.Response, e
} else {
log.Debug("Found user by email: ", existingUser)
if existingUser != nil {
if strings.Contains(existingUser.SignupMethods, "magic") {
res.Message = "registered"
if existingUser.EmailVerifiedAt != nil {
res.Message = "verified"
log.Debug("Email is already verified and signed up.")
return res, nil
} else if existingUser.ID != "" && existingUser.EmailVerifiedAt == nil {
res.Message = "not verified"
log.Debug("Email is already signed up. Verification pending...")
return res, nil
}
}
if strings.Contains(existingUser.SignupMethods, "magic") && !strings.Contains(existingUser.SignupMethods, "basic") {
res.Message = "registered"
} else if existingUser.EmailVerifiedAt != nil {
res.Message = "verified"
log.Debug("Email is already verified and signed up.")
return res, nil
} else if existingUser.ID != "" && existingUser.EmailVerifiedAt == nil {
res.Message = "not verified"
log.Debug("Email is already signed up. Verification pending...")
return res, nil
} else {
res.Message = "unknown"
log.Debug("Unknown signup method.")
return res, nil
}
}
}