Skip to content

Commit f9eca5a

Browse files
committed
feat: add additional fields to first time setup trial flow
1 parent f9f94b5 commit f9eca5a

File tree

21 files changed

+1336
-33
lines changed

21 files changed

+1336
-33
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ provisionersdk/proto/*.go linguist-generated=true
1212
*.tfstate.dot linguist-generated=true
1313
*.tfplan.dot linguist-generated=true
1414
site/src/api/typesGenerated.ts linguist-generated=true
15+
site/src/pages/SetupPage/countries.tsx linguist-generated=true

.github/workflows/typos.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ darcula = "darcula"
1414
Hashi = "Hashi"
1515
trialer = "trialer"
1616
encrypter = "encrypter"
17-
hel = "hel" # as in helsinki
17+
hel = "hel" # as in helsinki
1818

1919
[files]
2020
extend-exclude = [
@@ -31,4 +31,5 @@ extend-exclude = [
3131
"**/*.test.tsx",
3232
"**/pnpm-lock.yaml",
3333
"tailnet/testdata/**",
34+
"site/src/pages/SetupPage/countries.tsx",
3435
]

coderd/apidoc/docs.go

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/coderd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ type Options struct {
123123
TracerProvider trace.TracerProvider
124124
ExternalAuthConfigs []*externalauth.Config
125125
RealIPConfig *httpmw.RealIPConfig
126-
TrialGenerator func(ctx context.Context, email string) error
126+
TrialGenerator func(ctx context.Context, body codersdk.LicensorTrialRequest) error
127127
// TLSCertificates is used to mesh DERP servers securely.
128128
TLSCertificates []tls.Certificate
129129
TailnetCoordinator tailnet.Coordinator

coderd/coderdtest/coderdtest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ type Options struct {
107107
Auditor audit.Auditor
108108
TLSCertificates []tls.Certificate
109109
ExternalAuthConfigs []*externalauth.Config
110-
TrialGenerator func(context.Context, string) error
110+
TrialGenerator func(ctx context.Context, body codersdk.LicensorTrialRequest) error
111111
TemplateScheduleStore schedule.TemplateScheduleStore
112112
Coordinator tailnet.Coordinator
113113

coderd/externalauth/externalauth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ func (c *DeviceAuth) AuthorizeDevice(ctx context.Context) (*codersdk.ExternalAut
325325
// return a better error.
326326
switch resp.StatusCode {
327327
case http.StatusTooManyRequests:
328-
return nil, fmt.Errorf("rate limit hit, unable to authorize device. please try again later")
328+
return nil, xerrors.New("rate limit hit, unable to authorize device. please try again later")
329329
default:
330330
return nil, err
331331
}

coderd/httpapi/websocket.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import (
44
"context"
55
"time"
66

7-
"cdr.dev/slog"
87
"nhooyr.io/websocket"
8+
9+
"cdr.dev/slog"
910
)
1011

1112
// Heartbeat loops to ping a WebSocket to keep it alive.

coderd/promoauth/github.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package promoauth
22

33
import (
4-
"fmt"
54
"net/http"
65
"strconv"
76
"time"
7+
8+
"golang.org/x/xerrors"
89
)
910

1011
type rateLimits struct {
@@ -81,7 +82,7 @@ func (p *headerParser) string(key string) string {
8182

8283
v := p.header.Get(key)
8384
if v == "" {
84-
p.errors[key] = fmt.Errorf("missing header %q", key)
85+
p.errors[key] = xerrors.Errorf("missing header %q", key)
8586
}
8687
return v
8788
}

coderd/users.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,16 @@ func (api *API) postFirstUser(rw http.ResponseWriter, r *http.Request) {
152152
}
153153

154154
if createUser.Trial && api.TrialGenerator != nil {
155-
err = api.TrialGenerator(ctx, createUser.Email)
155+
err = api.TrialGenerator(ctx, codersdk.LicensorTrialRequest{
156+
Email: createUser.Email,
157+
FirstName: createUser.TrialInfo.FirstName,
158+
LastName: createUser.TrialInfo.LastName,
159+
PhoneNumber: createUser.TrialInfo.PhoneNumber,
160+
JobTitle: createUser.TrialInfo.JobTitle,
161+
CompanyName: createUser.TrialInfo.CompanyName,
162+
Country: createUser.TrialInfo.CompanyName,
163+
Developers: createUser.TrialInfo.Developers,
164+
})
156165
if err != nil {
157166
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
158167
Message: "Failed to generate trial",

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