Beispiel #1
0
        public bool CheckUniqueEmail(string email_bogie)
        {
            List <Admin> QueryAdmins = dbQuery.GetAdminsByEmail(email_bogie);

            if (QueryAdmins.Count == 0)
            {
                return(true);
            }
            else
            {
                return(false); //duplicate exists
            }
        }
Beispiel #2
0
        public Admin ValidateAdmin(string email, string password)  //returns admin with access token
        {
            List <Admin> QueryAdmins = dbQueryA.GetAdminsByEmail(email);

            string err_msg = "Password or Email Invalid";

            int   errors     = 0;
            Admin QueryAdmin = null;

            if (QueryAdmins.Count == 0)   //no matching email
            {
                errors += 1;
            }
            else
            {
                QueryAdmin = QueryAdmins[0];
                if (QueryAdmin.email_verified == false)
                {
                    errors += 1;
                    err_msg = "Account email has not yet been validated. Check email inbox for activation email.";
                }
                if (!VerifyHash(password, QueryAdmin.password))
                {
                    errors += 1;
                }
            }

            if (errors > 0)
            {
                throw new System.ArgumentException($"{err_msg}");
            }
            else
            {
                return(QueryAdmin);
            }
        }