(ctx context.Context, user database.User, passcode string)
| 308 | } |
| 309 | |
| 310 | func (api *API) notifyUserRequestedOneTimePasscode(ctx context.Context, user database.User, passcode string) error { |
| 311 | _, err := api.NotificationsEnqueuer.Enqueue( |
| 312 | //nolint:gocritic // We need the notifier auth context to be able to send the user their one-time passcode. |
| 313 | dbauthz.AsNotifier(ctx), |
| 314 | user.ID, |
| 315 | notifications.TemplateUserRequestedOneTimePasscode, |
| 316 | map[string]string{"one_time_passcode": passcode}, |
| 317 | "change-password-with-one-time-passcode", |
| 318 | user.ID, |
| 319 | ) |
| 320 | if err != nil { |
| 321 | return xerrors.Errorf("enqueue notification: %w", err) |
| 322 | } |
| 323 | |
| 324 | return nil |
| 325 | } |
| 326 | |
| 327 | // Change a users password with a one-time passcode. |
| 328 | // |
no test coverage detected