Skip to content

Commit 60fc32c

Browse files
fix: appease linter
1 parent b44adff commit 60fc32c

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

coderd/database/dbmem/dbmem.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9077,7 +9077,7 @@ func (q *FakeQuerier) UpdateUserGithubComUserID(_ context.Context, arg database.
90779077
return sql.ErrNoRows
90789078
}
90799079

9080-
func (q *FakeQuerier) UpdateUserHashedOneTimePasscode(ctx context.Context, arg database.UpdateUserHashedOneTimePasscodeParams) error {
9080+
func (q *FakeQuerier) UpdateUserHashedOneTimePasscode(_ context.Context, arg database.UpdateUserHashedOneTimePasscodeParams) error {
90819081
err := validateDatabaseType(arg)
90829082
if err != nil {
90839083
return err

coderd/userauth.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,15 @@ func (api *API) postRequestOneTimePasscode(rw http.ResponseWriter, r *http.Reque
281281
aReq.New = newUser
282282

283283
// Send the one-time-passcode to the user.
284-
api.notifyUserRequestedOneTimePasscode(ctx, user, passcode.String())
284+
err = api.notifyUserRequestedOneTimePasscode(ctx, user, passcode.String())
285+
if err != nil {
286+
logger.Error(ctx, "unable to notify user about one time passcode request", slog.Error(err))
287+
}
285288
}
286289

287-
func (api *API) notifyUserRequestedOneTimePasscode(ctx context.Context, user database.User, passcode string) {
290+
func (api *API) notifyUserRequestedOneTimePasscode(ctx context.Context, user database.User, passcode string) error {
288291
_, err := api.NotificationsEnqueuer.Enqueue(
292+
//nolint:gocritic // We need to be able to send the user their one time passcode.
289293
dbauthz.AsSystemRestricted(ctx),
290294
user.ID,
291295
notifications.TemplateUserRequestedOneTimePasscode,
@@ -294,8 +298,10 @@ func (api *API) notifyUserRequestedOneTimePasscode(ctx context.Context, user dat
294298
user.ID,
295299
)
296300
if err != nil {
297-
api.Logger.Warn(ctx, "unable to notify user about requested one-time-passcode", slog.F("affected_user", user.Username), slog.Error(err))
301+
return xerrors.Errorf("enqueue notification: %w", err)
298302
}
303+
304+
return nil
299305
}
300306

301307
// Change a users password with a one-time-passcode.

0 commit comments

Comments
 (0)