Show all possible external connections in Account security. Only allo…#42865
Show all possible external connections in Account security. Only allo…#42865
Conversation
…w one auth provider per URL
Bundle size report 📦
Look at the Statoscope report for a full comparison between the commits 447af6c and 288371b or learn more. Open explanation
|
kopancek
left a comment
There was a problem hiding this comment.
Looks great, small improvements suggested.
| @@ -81,19 +79,11 @@ export const UserSettingsSecurityPage: React.FunctionComponent<React.PropsWithCh | |||
| } | |||
|
|
|||
| // auth providers by service type | |||
There was a problem hiding this comment.
| // auth providers by service type | |
| // auth providers by serviceID |
| <H3 className="mb-3">Password</H3> | ||
| <Container> | ||
| <Form onSubmit={handleSubmit}> |
There was a problem hiding this comment.
I would be more specific here and specify the action in the header, similar as we do in the button at the end of the form.
| <H3 className="mb-3">Password</H3> | |
| <Container> | |
| <Form onSubmit={handleSubmit}> | |
| <H3 className="mb-3">{props.user.builtinAuth ? 'Update ' : 'Create '}Password</H3> | |
| <Container> | |
| <Form onSubmit={handleSubmit}> |
I would also add a description to this section, because on the screenshot it looks weird. E.g. something like (to be confirmed by @ryphil or someone with better language skills than me):
<p>Create a password for this user account on the <a href="docs">built-in username/password authentication.</a> This will allow the current user to login with username `{user.username}` and password in the future.</p>
And a similar one for the password change:
<p>Change password for this user account on the <a href="docs">built-in username/password authentication.</a></p>
Otherwise users might be confused as to which password they are going to create/change.
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff 288371b...447af6c.
|
unknwon
left a comment
There was a problem hiding this comment.
Did not look very close, thanks for fixing this!
| alreadyExists := false | ||
| for _, p := range ps { | ||
| if p.CachedInfo().ServiceID == provider.ServiceID { | ||
| problems = append(problems, conf.NewSiteProblems(fmt.Sprintf("cannot have more than one auth provider with url '%s', only the first one will be used", provider.ServiceID))...) |
There was a problem hiding this comment.
nit
| problems = append(problems, conf.NewSiteProblems(fmt.Sprintf("cannot have more than one auth provider with url '%s', only the first one will be used", provider.ServiceID))...) | |
| problems = append(problems, conf.NewSiteProblems(fmt.Sprintf(`Cannot have more than one auth provider with url %q, only the first one will be used`, provider.ServiceID))...) |
| alreadyExists := false | ||
| for _, p := range ps { | ||
| if p.CachedInfo().ServiceID == provider.ServiceID { | ||
| problems = append(problems, conf.NewSiteProblems(fmt.Sprintf("cannot have more than one auth provider with url '%s', only the first one will be used", provider.ServiceID))...) |
Solves #38195 and then some
Display all possible external service connections in user's Account Security page. Had to rework a lot of functions, because a lot of them assumed there would only be one provider per type, however, you can have multiple hosts of the same type. So now, instead, we use the auth provider's Service ID (the base URL) as the unique identifier, and we display config errors appropriately when more than one that uses the same URL is used. This is long overdue, as it would have caused undefined behaviour in some parts of the code anyways, when random auth providers are selected.
Further more, I made it so that the user's "Change Password" fields are visible even if they have external accounts, because signing in with a username and password is still valid.
Test plan
Updated unit tests