コード例 #1
0
        public IActionResult EditQuest(int id)
        {
            var model = _questDAO.FindOneRecordBy(id);

            if (model == null)
            {
                Response.StatusCode  = 404;
                ViewBag.ErrorMessage = "Sorry, you cannot edit this Quest!";
                return(View($"NotFound", id));
            }
            return(View($"EditQuest", model));
        }
コード例 #2
0
        public bool IsValidPasswordHASH(Credentials enteredCredentials)
        {
            if (enteredCredentials == null)
            {
                return(false);
            }
            if (enteredCredentials.Email == null)
            {
                return(false);
            }
            if (enteredCredentials.Password == null)
            {
                return(false);
            }

            Credentials userCredentialsInDb = _CredentialsDAO.FindOneRecordBy(enteredCredentials.Email);

            if (userCredentialsInDb == null)
            {
                return(false);
            }
            if (userCredentialsInDb.Password == null)
            {
                return(false);
            }
            if (userCredentialsInDb.SALT == null)
            {
                return(false);
            }

            string passwordFromDb = userCredentialsInDb.Password;

            byte[] passwordFromForm = EncryptPassword.CreateHASH(enteredCredentials.Password, userCredentialsInDb.SALT);

            if (SlowEquals(passwordFromDb.ConvertStringToByte(), passwordFromForm))
            {
                SetUserRoleAndCredentialId(userCredentialsInDb);
                return(true);
            }
            return(false);
        }
コード例 #3
0
        public IActionResult Edit(int id)
        {
            var group = _groupDAO.FindOneRecordBy(id);

            return(View(group));
        }