enh: make SOCIAL_AUTH_USERNAME_IS_FULL_EMAIL configurable#409
Conversation
|
Hi Camille, thanks for this. I think it's fine to expose this change. Python Social Auth chose a confusing name for it, though, and maybe we can do better. What is the intent of the variable? What do we use as username if this is not set—whatever the OAuth provider returns? Also, it would be good to document all added options. |
|
Hello,
I can add documentation on Skyportal side. The only goal to this PR is to expose SOCIAL_AUTH_USERNAME_IS_FULL_EMAIL variable and make it configurable. |
|
@camilledzt as we discussed on Thursday, please add a little of docs about these changes at the baselayer level. Please ping me once that's done and I'll review this and the SkyPortal PR! |
…thub.com/camilledzt/baselayer into enh_enable_username_is_full_email_config
|
Hi @Theodlz, I added some docs about the configuration related to the username generation. Does it seem fine for you ? |
stefanv
left a comment
There was a problem hiding this comment.
This looks good to me; I suggest we rename to username_is_email to make it more obvious what it does; "full" is confusing in the context of email addresses (what is a not-full email address!).
Ping me when you're ready to merge.
doc/setup.md
Outdated
|
|
||
| When `server.auth.username_is_full_email` is set to `True` (the default), the user's full email address is used as their username. | ||
|
|
||
| When set to `False`, the username is derived from the `username` field provided by the OAuth provider. For Google OAuth2, this is typically the local part of the email address (everything before `@`, e.g., `john.doe` from `john.doe@example.com`). |
There was a problem hiding this comment.
Do we have a sense of how it handles username conflicts?
There was a problem hiding this comment.
If that username is already taken, a random suffix is appended until a unique username is found. This logic is handled by the social_core library.
Co-authored-by: Stefan van der Walt <stefan@mentat.za.net>
|
@camilledzt is this ready for another round of review? |
|
Yes it's ready @Theodlz |
|
I will check the lint failing job |
|
Done. @Theodlz , can you approve this workflow ? |
The goal of this PR is to make
SOCIAL_AUTH_USERNAME_IS_FULL_EMAILconfigurable viaserver.auth.username_is_emailconfig option instead of being hardcoded. Default value is set to True