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

User can register account #2

Open
jisie opened this issue Jan 8, 2019 · 3 comments
Open

User can register account #2

jisie opened this issue Jan 8, 2019 · 3 comments
Assignees

Comments

@jisie
Copy link

jisie commented Jan 8, 2019

Story

As a user, I should be able to fill out a form with my email address, and the username of my choice to register myself in the application

Acceptance Criteria

Given a user wants to use Nutshell
When the user first accesses the application
Then the user should see a welcome message
And a hyperlink to the registration form

Given a user wants to register an account with Nutshell
When the user clicks the Register a new account hyperlink
Then a registration form should be displayed where the user can enter in an email address and a username

Given a user has filled out both fields of the registration form
When the user clicks the Register button
Then the system should check if the username is unique
And it should check if the email address is unique
And if both are unique, a new account should be created
And the user should be taken to the main view of Nutshell

@hannahmneal hannahmneal modified the milestone: Testing Jan 9, 2019
@hannahmneal
Copy link
Contributor

hannahmneal commented Jan 10, 2019

// ------------------------------BEGIN WORKING CODE -----------------------------------
let submitForm = document.getElementById("submit-form-btn").addEventListener("click", function(event) {
    // let formFields = document.querySelector(".input") //Returns undefined when logged
    //Try jQuery instead: // let formFields = $("input").value; // Undefined.
    // Perhaps JS is evaluating the individual values for the input sections as ONE input and cannot work with querySelectorAll.
        let firstNameInput = document.querySelector("#first-name-input");   //This works.
        let lastNameInput = document.getElementById("last-name-input");
        let addressInput = document.getElementById("address-input");
        console.log(firstNameInput.value, lastNameInput.value,addressInput.value); // Works!
})
        let newPerson = {
            formFirstName: firstNameInput.value,
            formLastName: lastNameInput.value,
            formAddress: addressInput.value
        }
// ------------------------------END WORKING CODE -----------------------------------

The code below is supposed to check whether the person already exists in the db and if so, alert the user. If the person does not already exist in the db, the person will be added and registration completed:

        const personCheckAdd = {
            handlePeople() {
            contactsFetch.forEach(contact => {
                if(firstNameInput.value == firstNameInput && lastNameInput.value == lastNameInput && addressInput.value == addressInput) {
                    alert("This contact already exists!");
                } else {
                    contactCollection.contactsFetch()
                    .then(contact => {

                        // POST method here
                        addNewPerson(newPerson);
                }
         })
// call handlePeople from contactList
        }```

@hannahmneal
Copy link
Contributor

Y'all will have to let me know if you have any questions about my "code-inserting" skills in Github.

@zwcrawford
Copy link
Contributor

Zac is taking this....for now.

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

3 participants