Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile doesn't show email when "email as username" set. API broken. #103

Closed
xgp opened this issue Jul 6, 2023 · 2 comments · Fixed by #106
Closed

Profile doesn't show email when "email as username" set. API broken. #103

xgp opened this issue Jul 6, 2023 · 2 comments · Fixed by #106
Assignees
Labels
bug Something isn't working

Comments

@xgp
Copy link
Member

xgp commented Jul 6, 2023

image

Email doesn't get set when "email as username" is used. This appears to be a problem with the user account API

image

As a workaround, maybe we should look in the username for a valid email if an email field is not present.

@xgp xgp added the bug Something isn't working label Jul 6, 2023
@xgp xgp assigned pnzrr Jul 6, 2023
@xgp
Copy link
Member Author

xgp commented Jul 12, 2023

Look at #81 in conjunction with fixing this.

@pnzrr
Copy link
Contributor

pnzrr commented Jul 16, 2023

featureFlags.registrationEmailAsUsername we're using this to decide whether or not to show the "username" right now, but I don't think that logic is right then.

{!featureFlags.registrationEmailAsUsername && (
            <RHFFormTextInputWithLabel
              slug="username"
              label={t("username")}
              register={register}
              registerArgs={{
                required: true,
                pattern: /\S+@\S+\.\S+/,
              }}
              inputArgs={{
                disabled: isLoadingAccount || !featureFlags.editUsernameAllowed,
                placeholder: "you",
                type: "username",
              }}
              error={errors.username}
            />
          )}
          <RHFFormTextInputWithLabel
            slug="email"
            label={t("email")}
            register={register}
            registerArgs={{
              required: true,
              pattern: /\S+@\S+\.\S+/,
            }}
            inputArgs={{
              disabled:
                isLoadingAccount || !featureFlags.updateEmailFeatureEnabled,
              placeholder: "[email protected]",
              type: "email",
            }}
            error={errors.email}
          />

I think the logic needs to be

  • If the registrationEmailAsUsername is true, show a "Username / Email" form field. Only update the "username" though in this case. I think trying to set the email field when registrationEmailAsUsername might cause drift between username and email and you want them to stay in lockstep. I did this, the form validates (in browser) for a valid email.
image
  • I think your suggestion of checking for a valid email in the username is unnecessary if that's already being set by the system? Or by allowing update of the username attribute, could that force not allowing a valid email? Which would mean we need the form to do that validity checking?
  • If registrationEmailAsUsername is false, then show both username and email fields. Can we be sure username is set at this point? Should the form require it?
image

@pnzrr pnzrr mentioned this issue Jul 16, 2023
@xgp xgp closed this as completed in #106 Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants