function checkIfUserExists(givenEmail, givenPassword) {
    for (let i = 0; i < database.users.length; i++) {
        let user = database.users[i];

        if (givenEmail == user.email && givenPassword == atob(user.password)) {
            currentUser.email = user.email;
            currentUser.firstName = user.firstName;
            currentUser.id = user.id;

            sessionStorage.setItem('currentUser', JSON.stringify(currentUser));
            return true;
        }
    }

    feedbackMessage.innerHTML = 'E-mail ou senha inválidos.';
    feedbackMessage.style.display = 'block';
    return false;
}
// Checks if the user exists on the database and sends it's data to sessionStorage
Checks if the user exists on the database and sends it's data to sessionStorage
Checks if the user exists on the database and sends it ' s data to sessionStorage
function checkIfUserExists(givenEmail, givenPassword) {
    for (let i = 0; i < database.users.length; i++) {
        let user = database.users[i];
        if (givenEmail == user.email && givenPassword == atob(user.password)) {
            currentUser.email = user.email;
            currentUser.firstName = user.firstName;
            currentUser.id = user.id;
            sessionStorage.setItem('currentUser', JSON.stringify(currentUser));
            return true;
        }
    }
    feedbackMessage.innerHTML = 'E-mail ou senha inválidos.';
    feedbackMessage.style.display = 'block';
    return false;
}
function checkIfUserExists ( givenEmail , givenPassword ) { for ( let i = 0 ; i < database . users . length ; i ++ ) { let user = database . users [ i ] ; if ( givenEmail == user . email && givenPassword == atob ( user . password ) ) { currentUser . email = user . email ; currentUser . firstName = user . firstName ; currentUser . id = user . id ; sessionStorage . setItem ( 'currentUser' , JSON . stringify ( currentUser ) ) ; return true ; } } feedbackMessage . innerHTML = 'E-mail ou senha inválidos.'; feedbackMessage . style . display = 'block' ; return false ; }
Checks if the user exists on the database and sends it's data to sessionStorage
Checks if the user exists on the database and sends it ' s data to sessionStorage