Skip to content

Commit

Permalink
💄
Browse files Browse the repository at this point in the history
  • Loading branch information
yackermann committed Feb 16, 2023
1 parent 118abeb commit 1281ebe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion api/user.auth.api.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (h *UserAPI) Register(w http.ResponseWriter, r *http.Request) {
}

err = h.Notify.NotifyUserRegistration_AccountValidation(newUserInst.Email, services.NotifyPayload{
TargetEmail: newUserInst.Email,
VendorEmail: newUserInst.Email,
VendorName: newUserInst.Name,
VendorPhone: createUser.Phone,
VendorCompany: newUserInst.Company,
Expand Down
2 changes: 1 addition & 1 deletion api/user.other.api.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func (h *UserAPI) AdditionalInfo(w http.ResponseWriter, r *http.Request) {
submissionCountry := commonapi.ExtractCloudflareLocation(r)

err = h.Notify.NotifyUserRegistration_AccountValidation(newUserInst.Email, services.NotifyPayload{
TargetEmail: newUserInst.Email,
VendorEmail: newUserInst.Email,
VendorName: additonalInfo.Name,
VendorPhone: additonalInfo.Phone,
VendorCompany: additonalInfo.Company,
Expand Down
13 changes: 6 additions & 7 deletions services/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import (
const FIDO_NOTIFY_EMAIL = "[email protected]"

type NotifyPayload struct {
TargetEmail string `json:"target_email"`

VendorEmail string `json:"vendor_email"`
VendorName string `json:"vendor_name"`
VendorPhone string `json:"vendor_phone"`
VendorCompany string `json:"vendor_company"`
Expand Down Expand Up @@ -97,7 +96,7 @@ func (h *NotifyService) NotifyUserRegistration_EmailVerification(email string, s
emailVerificationLink := fmt.Sprintf("%s/api/user/email/check/%s/%s", ctx.Value(fdoshared.CFG_ENV_FDO_SERVICE_URL).(string), string(entryId), email)

return h.sendEmailNotification(NotifyPayload{
TargetEmail: email,
VendorEmail: email,
ApproveLink: emailVerificationLink,
Type: dbs.VT_Email,
})
Expand All @@ -116,7 +115,7 @@ func (h *NotifyService) NotifyUserRegistration_AccountValidation(email string, u
reqPayload := userInfo
reqPayload.ApproveLink = userApprovalLink
reqPayload.RejectLink = userRejectLink
reqPayload.TargetEmail = email
reqPayload.VendorEmail = email
reqPayload.SubmissionCountry = submissionCountry
reqPayload.Type = dbs.VT_AccountValidation

Expand All @@ -126,15 +125,15 @@ func (h *NotifyService) NotifyUserRegistration_AccountValidation(email string, u
// Send FIDO email about new user
func (h *NotifyService) NotifyUserRegistration_Approved(email string, ctx context.Context) error {
return h.sendEmailNotification(NotifyPayload{
TargetEmail: email,
VendorEmail: email,
Type: dbs.VT_RegistrationApproved,
})
}

// Send FIDO email about new user
func (h *NotifyService) NotifyUserRegistration_Rejected(email string, ctx context.Context) error {
return h.sendEmailNotification(NotifyPayload{
TargetEmail: email,
VendorEmail: email,
Type: dbs.VT_RegistrationRejected,
})
}
Expand All @@ -148,7 +147,7 @@ func (h *NotifyService) NotifyUserRegistration_PasswordReset(email string, ctx c
resetLink := fmt.Sprintf("%s/api/user/password/reset/%s/%s", ctx.Value(fdoshared.CFG_ENV_FDO_SERVICE_URL).(string), string(entryId), email)

return h.sendEmailNotification(NotifyPayload{
TargetEmail: email,
VendorEmail: email,
PasswordResetLink: resetLink,
Type: dbs.VT_PasswordReset,
})
Expand Down

0 comments on commit 1281ebe

Please sign in to comment.