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

odd error message when signing up with an email or username that is taken #4810

Open
RayBB opened this issue Dec 10, 2020 · 1 comment · May be fixed by #6792
Open

odd error message when signing up with an email or username that is taken #4810

RayBB opened this issue Dec 10, 2020 · 1 comment · May be fixed by #6792
Labels

Comments

@RayBB
Copy link

RayBB commented Dec 10, 2020

Issue details

When signing up for an account and trying to register with a email or username that has already been used the text of the error message is a bit strange, giving two errors instead of one.

It displays:

The email is already used.
This value is already used.

It would be preferred to just display the first line and not display the second one.

This is a very small issue but likely an easy fix for a better UX.

Thanks for the hard work all!

Environment

wallabag version that exhibits the issue: wallabag.it on Dec 10, 2020

Steps to reproduce/test case

  1. navigate to https://app.wallabag.it/register/
  2. enter your email (or any already used one)
  3. enter the username ray
  4. enter any password
  5. click "register"

Screenshot

image

@RayBB RayBB changed the title odd error message when signing up with an email or username is taken odd error message when signing up with an email or username that is taken Dec 10, 2020
@nicosomb nicosomb added the Bug label Aug 3, 2023
@nicosomb
Copy link
Member

nicosomb commented Aug 3, 2023

Hello @RayBB

Thank you for this bug report.

I can reproduce locally.

In fact, it's because our User class defines 2 UniqueEntity: username and email.
And our User class extends also FOS\UserBundle\Model\User which already has UniqueEntity on these 2 fields. See vendor/friendsofsymfony/user-bundle/Resources/config/storage-validation/orm.xml:

    <class name="FOS\UserBundle\Model\User">
        <constraint name="Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity">
            <option name="fields">usernameCanonical</option>
            <option name="errorPath">username</option>
            <option name="message">fos_user.username.already_used</option>
            <option name="groups">
                <value>Registration</value>
                <value>Profile</value>
            </option>
        </constraint>

        <constraint name="Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity">
            <option name="fields">emailCanonical</option>
            <option name="errorPath">email</option>
            <option name="message">fos_user.email.already_used</option>
            <option name="groups">
                <value>Registration</value>
                <value>Profile</value>
            </option>
        </constraint>
    </class>

If we delete this constraint definition, it's OK for the view side (the html form).
But on the API side, the constraint definition seems to be useful 🤔

Here is a draft PR: #6792

@Kdecherf @j0k3r I need your opinion about this bug please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants