コード例 #1
0
        public IActionResult ChangePasswd([FromBody] ChangePasswd UCP)
        {
            try
            {
                if (UCP.Email.Length == 0)
                {
                    throw new ValidationException("Email empty (" + where + ") (CHG)");
                }
                if (UCP.OldPasswd.Length == 0)
                {
                    throw new ValidationException("Old Password empty (" + where + ") (CHG)");
                }
                if (UCP.Passwd.Length == 0)
                {
                    throw new ValidationException("Password empty (" + where + ") (CHG)");
                }

                bool EmailOK = S.ServiceLocator.Instance.usersService.EmailIsUsed(UCP.Email);
                if (!EmailOK)
                {
                    throw new ValidationException("Email Not Found :" + UCP.Email);
                }

                return(ApiControllerHelper.SendOk(this, new ApiResult <bool>(HttpStatusCode.OK, null, S.ServiceLocator.Instance.usersService.ChangePasswd(UCP.Email, Base64.Base64Decode(UCP.OldPasswd), Base64.Base64Decode(UCP.Passwd))), true));
            }
            catch (Exception ex)
            {
                return(ApiControllerHelper.SendError(this, ex));
            }
        }
コード例 #2
0
        public int ChangeTeacherPassword(ChangePasswd changePasswd)
        {
            var result = _updateToDb.UpdateTeacherPassword(changePasswd);

            return(result);
        }