(ctx context.Context, userID string)
| 561 | } |
| 562 | |
| 563 | func (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 | |
| 586 | func (us *UserService) UserVerifyEmail(ctx context.Context, req *schema.UserVerifyEmailReq) (resp *schema.UserLoginResp, err error) { |
| 587 | data := &schema.EmailCodeContent{} |
nothing calls this directly
no test coverage detected