mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
feat: implement api for "forgot password?" flow (#14915)
Relates to https://github.com/coder/coder/issues/14232 This implements two endpoints (names subject to change): - `/api/v2/users/otp/request` - `/api/v2/users/otp/change-password`
This commit is contained in:
@ -128,6 +128,9 @@ type Options struct {
|
||||
LoginRateLimit int
|
||||
FilesRateLimit int
|
||||
|
||||
// OneTimePasscodeValidityPeriod specifies how long a one time passcode should be valid for.
|
||||
OneTimePasscodeValidityPeriod time.Duration
|
||||
|
||||
// IncludeProvisionerDaemon when true means to start an in-memory provisionerD
|
||||
IncludeProvisionerDaemon bool
|
||||
ProvisionerDaemonTags map[string]string
|
||||
@ -311,6 +314,10 @@ func NewOptions(t testing.TB, options *Options) (func(http.Handler), context.Can
|
||||
options.NotificationsEnqueuer = &testutil.FakeNotificationsEnqueuer{}
|
||||
}
|
||||
|
||||
if options.OneTimePasscodeValidityPeriod == 0 {
|
||||
options.OneTimePasscodeValidityPeriod = testutil.WaitLong
|
||||
}
|
||||
|
||||
var templateScheduleStore atomic.Pointer[schedule.TemplateScheduleStore]
|
||||
if options.TemplateScheduleStore == nil {
|
||||
options.TemplateScheduleStore = schedule.NewAGPLTemplateScheduleStore()
|
||||
@ -530,6 +537,7 @@ func NewOptions(t testing.TB, options *Options) (func(http.Handler), context.Can
|
||||
DatabaseRolluper: options.DatabaseRolluper,
|
||||
WorkspaceUsageTracker: wuTracker,
|
||||
NotificationsEnqueuer: options.NotificationsEnqueuer,
|
||||
OneTimePasscodeValidityPeriod: options.OneTimePasscodeValidityPeriod,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user