fix: refs for cassandra db
This commit is contained in:
@@ -81,13 +81,15 @@ func SignupResolver(ctx context.Context, params model.SignUpInput) (*model.AuthR
|
||||
log.Debug("Failed to get user by email: ", err)
|
||||
}
|
||||
|
||||
if existingUser.EmailVerifiedAt != nil {
|
||||
// email is verified
|
||||
log.Debug("Email is already verified and signed up.")
|
||||
return res, fmt.Errorf(`%s has already signed up`, params.Email)
|
||||
} else if existingUser.ID != "" && existingUser.EmailVerifiedAt == nil {
|
||||
log.Debug("Email is already signed up. Verification pending...")
|
||||
return res, fmt.Errorf("%s has already signed up. please complete the email verification process or reset the password", params.Email)
|
||||
if existingUser != nil {
|
||||
if existingUser.EmailVerifiedAt != nil {
|
||||
// email is verified
|
||||
log.Debug("Email is already verified and signed up.")
|
||||
return res, fmt.Errorf(`%s has already signed up`, params.Email)
|
||||
} else if existingUser.ID != "" && existingUser.EmailVerifiedAt == nil {
|
||||
log.Debug("Email is already signed up. Verification pending...")
|
||||
return res, fmt.Errorf("%s has already signed up. please complete the email verification process or reset the password", params.Email)
|
||||
}
|
||||
}
|
||||
|
||||
inputRoles := []string{}
|
||||
@@ -116,13 +118,10 @@ func SignupResolver(ctx context.Context, params model.SignUpInput) (*model.AuthR
|
||||
inputRoles = strings.Split(inputRolesString, ",")
|
||||
}
|
||||
}
|
||||
|
||||
user := &models.User{
|
||||
Email: params.Email,
|
||||
}
|
||||
|
||||
user.Roles = strings.Join(inputRoles, ",")
|
||||
|
||||
password, _ := crypto.EncryptPassword(params.Password)
|
||||
user.Password = &password
|
||||
|
||||
|
@@ -61,8 +61,9 @@ func VerifyOtpResolver(ctx context.Context, params model.VerifyOTPRequest) (*mod
|
||||
} else {
|
||||
user, err = db.Provider.GetUserByPhoneNumber(ctx, refs.StringValue(params.PhoneNumber))
|
||||
}
|
||||
if user.ID == "" && err != nil {
|
||||
log.Debug("Failed to get user by email: ", err)
|
||||
if user == nil || err != nil {
|
||||
fmt.Println("=> failing here....", err)
|
||||
log.Debug("Failed to get user by email or phone number: ", err)
|
||||
return res, err
|
||||
}
|
||||
isSignUp := user.EmailVerifiedAt == nil && user.PhoneNumberVerifiedAt == nil
|
||||
|
Reference in New Issue
Block a user