Add magic link login for trust center

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-01-15 12:31:10 +04:00
committed by Bryan Frimin
parent 8ff4693bfc
commit 8b3bda56e6
42 changed files with 1880 additions and 993 deletions

View File

@@ -122,18 +122,43 @@ func (b *BaseURL) WithPath(path string) *URLBuilder {
return &URLBuilder{err: fmt.Errorf("base URL is nil")}
}
// Ensure path does not end with /
basePath := strings.TrimSuffix(b.parsed.Path, "/")
// Ensure path starts with /
if !strings.HasPrefix(path, "/") {
path = "/" + path
}
// Ensure path does not end with /
path = strings.TrimSuffix(path, "/")
return &URLBuilder{
base: b,
path: path,
path: basePath + path,
query: make(url.Values),
}
}
// WithPath returns a URLBuilder with the specified path.
// The path will be properly joined with the base URL.
func (ub *URLBuilder) WithPath(path string) *URLBuilder {
if ub == nil {
return ub
}
// Ensure path starts with /
if !strings.HasPrefix(path, "/") {
path = "/" + path
}
// Ensure path does not end with /
path = strings.TrimSuffix(path, "/")
ub.path = ub.path + path
return ub
}
// WithQuery adds a query parameter to the URL.
func (ub *URLBuilder) WithQuery(key, value string) *URLBuilder {
if ub.err != nil {