Ejemplo n.º 1
0
        public bool SetNewPass(dynamic pss)
        {
            try
            {
                KIMODBEntities db11 = new KIMODBEntities();
                string         usr  = pss.usrn;
                User           user = db11.Users.Where(k => k.UserName == usr).FirstOrDefault();
                if (user != null)
                {
                    var    hash = GenerateHash(pss.pssw.Value); // Do you have to use the word value
                    string newP = hash;
                    user.UserPassword = newP;
                    user.UserPasswordChangeRequest = false;
                    //user.UserPassword = pss.pssw;

                    db11.Entry(user).State = EntityState.Modified;
                    db11.SaveChanges();

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        //function to determine if username already exists
        private bool UserExists(string usrName)
        {
            KIMODBEntities db = new KIMODBEntities();

            db.Configuration.ProxyCreationEnabled = false;

            foreach (User usr in db.Users)
            {
                if (usr.UserName == usrName)
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 3
0
        public string doesUserExist(string usrName)
        {
            KIMODBEntities db = new KIMODBEntities();

            db.Configuration.ProxyCreationEnabled = false;

            foreach (User usr in db.Users)
            {
                if (usr.UserName == usrName)
                {
                    return("true");
                }
            }
            return("false");
        }
Ejemplo n.º 4
0
 private bool setOTP(string usrn, string OTP)
 {
     try
     {
         KIMODBEntities db10 = new KIMODBEntities();
         User           usr  = db10.Users.Where(y => y.UserName == usrn).FirstOrDefault();
         usr.ResetOTP = OTP;
         usr.UserPasswordChangeRequest = true;
         db10.Entry(usr).State         = EntityState.Modified;
         db10.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }