MarkEmailActivated marks the email address of the given user as activated, and new rands are generated for the user.
(ctx context.Context, userID int64, email string)
| 1125 | // MarkEmailActivated marks the email address of the given user as activated, |
| 1126 | // and new rands are generated for the user. |
| 1127 | func (s *UsersStore) MarkEmailActivated(ctx context.Context, userID int64, email string) error { |
| 1128 | return s.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error { |
| 1129 | err := s.db.WithContext(ctx). |
| 1130 | Model(&EmailAddress{}). |
| 1131 | Where("uid = ? AND email = ?", userID, email). |
| 1132 | Update("is_activated", true). |
| 1133 | Error |
| 1134 | if err != nil { |
| 1135 | return errors.Wrap(err, "mark email activated") |
| 1136 | } |
| 1137 | |
| 1138 | return newUsersStore(tx).Update(ctx, userID, UpdateUserOptions{GenerateNewRands: true}) |
| 1139 | }) |
| 1140 | } |
| 1141 | |
| 1142 | type ErrEmailNotVerified struct { |
| 1143 | args errutil.Args |