Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions server/ui-edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h2>
</div>
{{end}}

{{if and .Secret .IsNew}}
{{if and .Secret .JustCreated}}
<div class="client-info">
<h3>Client Created Successfully!</h3>
<p class="warning">⚠️ Save both the Client ID and Secret now! The secret will not be shown again.</p>
Expand Down Expand Up @@ -76,6 +76,7 @@ <h3>New Client Secret</h3>
value="{{.Name}}"
placeholder="e.g., My Application"
class="form-input"
{{if .JustCreated}}readonly{{end}}
>
<div class="form-help">
A descriptive name for this OIDC client (optional).
Expand All @@ -91,6 +92,7 @@ <h3>New Client Secret</h3>
class="form-input"
rows="4"
required
{{if .JustCreated}}readonly{{end}}
>{{joinRedirectURIs .RedirectURIs}}</textarea>
<div class="form-help">
Enter one redirect URI per line. Users will be redirected to one of these URLs after authentication.
Expand All @@ -113,9 +115,14 @@ <h3>New Client Secret</h3>
{{end}}

<div class="form-actions">
<button type="submit" class="btn btn-primary">
{{if .IsNew}}Create Client{{else}}Update Client{{end}}
</button>
{{if .JustCreated}}
<input type="hidden" name="just_created" value="true">
<a href="/" class="btn btn-secondary">← Back to Clients</a>
{{else}}
<button type="submit" class="btn btn-primary">
{{if .IsNew}}Create Client{{else}}Update Client{{end}}
</button>
{{end}}

{{if .IsEdit}}
<button type="submit" name="action" value="regenerate_secret" class="btn btn-warning"
Expand Down Expand Up @@ -195,4 +202,4 @@ <h3>Client Information</h3>
}
</script>
</body>
</html>
</html>
7 changes: 7 additions & 0 deletions server/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ func (s *IDPServer) handleNewClient(w http.ResponseWriter, r *http.Request) {
return
}

if r.FormValue("just_created") == "true" {
http.Redirect(w, r, "/", http.StatusSeeOther)
return
}

name := strings.TrimSpace(r.FormValue("name"))
redirectURIsText := strings.TrimSpace(r.FormValue("redirect_uris"))
redirectURIs := splitRedirectURIs(redirectURIsText)
Expand Down Expand Up @@ -176,6 +181,7 @@ func (s *IDPServer) handleNewClient(w http.ResponseWriter, r *http.Request) {
RedirectURIs: redirectURIs,
Secret: clientSecret,
IsNew: true,
JustCreated: true,
}
s.renderFormSuccess(w, r, successData, "Client created successfully! Save the client secret - it won't be shown again.")
return
Expand Down Expand Up @@ -327,6 +333,7 @@ type clientDisplayData struct {
RedirectURIs []string
Secret string
HasSecret bool
JustCreated bool
IsNew bool
IsEdit bool
Success string
Expand Down