mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-02-13 19:46:32 +01:00
[bugfix] Suggest lowercase username when creating via OIDC (#3780)
This commit is contained in:
parent
4ac5447ad6
commit
2c95fd4115
2 changed files with 8 additions and 2 deletions
|
@ -145,12 +145,18 @@ func (m *Module) CallbackGETHandler(c *gin.Context) {
|
||||||
return
|
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{
|
page := apiutil.WebPage{
|
||||||
Template: "finalize.tmpl",
|
Template: "finalize.tmpl",
|
||||||
Instance: instance,
|
Instance: instance,
|
||||||
Extra: map[string]any{
|
Extra: map[string]any{
|
||||||
"name": claims.Name,
|
"name": claims.Name,
|
||||||
"preferredUsername": claims.PreferredUsername,
|
"suggestedUsername": suggestedUsername,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
placeholder="Please enter your desired username"
|
placeholder="Please enter your desired username"
|
||||||
pattern="^[a-z0-9_]{1,64}$"
|
pattern="^[a-z0-9_]{1,64}$"
|
||||||
title="lowercase a-z, numbers, and underscores; max 64 characters"
|
title="lowercase a-z, numbers, and underscores; max 64 characters"
|
||||||
value="{{- .preferredUsername -}}"
|
value="{{- .suggestedUsername -}}"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="name" value="{{- .name -}}">
|
<input type="hidden" name="name" value="{{- .name -}}">
|
||||||
|
|
Loading…
Reference in a new issue