MCPcopy Index your code
hub / github.com/apache/answer / UserVerifyEmailSend

Method UserVerifyEmailSend

internal/service/content/user_service.go:563–584  ·  view source on GitHub ↗
(ctx context.Context, userID string)

Source from the content-addressed store, hash-verified

561}
562
563func (us *UserService) UserVerifyEmailSend(ctx context.Context, userID string) error {
564 userInfo, has, err := us.userRepo.GetByUserID(ctx, userID)
565 if err != nil {
566 return err
567 }
568 if !has {
569 return errors.BadRequest(reason.UserNotFound)
570 }
571
572 data := &schema.EmailCodeContent{
573 Email: userInfo.EMail,
574 UserID: userInfo.ID,
575 }
576 code := token.GenerateToken()
577 verifyEmailURL := fmt.Sprintf("%s/users/account-activation?code=%s", us.getSiteUrl(ctx), code)
578 title, body, err := us.emailService.RegisterTemplate(ctx, verifyEmailURL)
579 if err != nil {
580 return err
581 }
582 go us.emailService.SendAndSaveCode(ctx, userInfo.ID, userInfo.EMail, title, body, code, data.ToJSONString())
583 return nil
584}
585
586func (us *UserService) UserVerifyEmail(ctx context.Context, req *schema.UserVerifyEmailReq) (resp *schema.UserLoginResp, err error) {
587 data := &schema.EmailCodeContent{}

Callers

nothing calls this directly

Calls 6

getSiteUrlMethod · 0.95
ToJSONStringMethod · 0.95
GenerateTokenFunction · 0.92
RegisterTemplateMethod · 0.80
SendAndSaveCodeMethod · 0.80
GetByUserIDMethod · 0.65

Tested by

no test coverage detected