Beispiel #1
0
        // Controlleren van de username overeenkomt met het wachtwoord van de gebruiker.
        public user_frontend Login(Login_credentials login)
        {
            var query = from u in _context.Users
                        where u.E_mail == login.email
                        select new { u.ID, u.Password, u.E_mail, u.Name, u.Surname, u.Salt };

            string uitkomst = "";

            int count = query.Count();

            if (count == 1)
            {
                foreach (var item in query)
                {
                    if (SHA.Checkpassword(login.password, item.Salt, item.Password))
                    {
                        return(new user_frontend(true, item.Name, item.Surname, item.E_mail, item.ID));
                    }
                }
            }

            return(new user_frontend(false, "", "", "", -1));
        }