p2-inc / phasetwo-admin-portal

https://phasetwo.io
Other
18 stars 14 forks source link

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

Closed xgp closed 1 year ago

xgp commented 1 year ago

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 commented 1 year ago

Look at https://github.com/p2-inc/phasetwo-admin-portal/issues/81 in conjunction with fixing this.

pnzrr commented 1 year ago

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: "your@email.com",
              type: "email",
            }}
            error={errors.email}
          />

I think the logic needs to be

image image