summaryrefslogtreecommitdiff
path: root/internal/api
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2025-02-11 09:42:35 +0100
committerLibravatar GitHub <noreply@github.com>2025-02-11 09:42:35 +0100
commit2c95fd41155e6c419145ed57acfeb32b8b59f3d6 (patch)
treeb5f94bb14c76396d54b1893e0f6d4b8573a19e96 /internal/api
parent[chore]: Bump golang.org/x/crypto from 0.32.0 to 0.33.0 (#3771) (diff)
downloadgotosocial-2c95fd41155e6c419145ed57acfeb32b8b59f3d6.tar.xz
[bugfix] Suggest lowercase username when creating via OIDC (#3780)
Diffstat (limited to 'internal/api')
-rw-r--r--internal/api/auth/callback.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/api/auth/callback.go b/internal/api/auth/callback.go
index 37c257229..2dc36fac8 100644
--- a/internal/api/auth/callback.go
+++ b/internal/api/auth/callback.go
@@ -145,12 +145,18 @@ func (m *Module) CallbackGETHandler(c *gin.Context) {
return
}
+ // Since we require lowercase usernames at this point, lowercase the one
+ // from the claims and use this to autofill the form with a suggestion.
+ //
+ // Pending https://github.com/superseriousbusiness/gotosocial/issues/1813
+ suggestedUsername := strings.ToLower(claims.PreferredUsername)
+
page := apiutil.WebPage{
Template: "finalize.tmpl",
Instance: instance,
Extra: map[string]any{
"name": claims.Name,
- "preferredUsername": claims.PreferredUsername,
+ "suggestedUsername": suggestedUsername,
},
}