Skip to content

Commit 131babf

Browse files
authored
fix: request trial after password is validated (#8750)
1 parent 25e30c6 commit 131babf

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

coderd/users.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,6 @@ func (api *API) postFirstUser(rw http.ResponseWriter, r *http.Request) {
9797
return
9898
}
9999

100-
if createUser.Trial && api.TrialGenerator != nil {
101-
err = api.TrialGenerator(ctx, createUser.Email)
102-
if err != nil {
103-
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
104-
Message: "Failed to generate trial",
105-
Detail: err.Error(),
106-
})
107-
return
108-
}
109-
}
110-
111100
err = userpassword.Validate(createUser.Password)
112101
if err != nil {
113102
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
@@ -120,6 +109,17 @@ func (api *API) postFirstUser(rw http.ResponseWriter, r *http.Request) {
120109
return
121110
}
122111

112+
if createUser.Trial && api.TrialGenerator != nil {
113+
err = api.TrialGenerator(ctx, createUser.Email)
114+
if err != nil {
115+
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
116+
Message: "Failed to generate trial",
117+
Detail: err.Error(),
118+
})
119+
return
120+
}
121+
}
122+
123123
//nolint:gocritic // needed to create first user
124124
user, organizationID, err := api.CreateUser(dbauthz.AsSystemRestricted(ctx), api.Database, CreateUserRequest{
125125
CreateUserRequest: codersdk.CreateUserRequest{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy