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

Do not allow duplicate contact info #6

Open
juntao opened this issue Jun 13, 2019 · 1 comment
Open

Do not allow duplicate contact info #6

juntao opened this issue Jun 13, 2019 · 1 comment
Assignees

Comments

@juntao
Copy link
Collaborator

juntao commented Jun 13, 2019

When the user submits the play form, we should check against all players retrieved by that page. If the contact info is duplicate, we should not let the user submit.

@Atlasoin
Copy link
Member

When loading all players, their emails are kept in a global contacts variable. Just for raising a bit difficulty in getting all players' emails, a hashCode function is implemented.

var email = rpi[3].split(":")[1].trim();
contacts.push(hashCode(email))

When submit, the input email will be checked. For better usability, regex checking email format is also added:

        if (contacts.indexOf(hashCode(contactId)) !== -1){
            tip.error(lgb.contact_error);
            return;
        }
        if (!validateEmail(contactId)){
            tip.error(lgb.email_error);
            return;            
        }

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

No branches or pull requests

2 participants