Example #1
0
        public async Task <CommonResponce> ChangeProfilePasswordAsync(ChangeProfilePasswordVM oModel)
        {
            CommonResponce result = new CommonResponce {
                Stat = false, StatusMsg = ""
            };
            var oUser = await _DBUserRepository.GetUserByID(oModel.Id).ConfigureAwait(false);

            if (oUser != null)
            {
                if (oUser.Password.Equals(_AppEncription.EncriptWithPrivateKey(oModel.OldPassword)))
                {
                    oUser.Password = _AppEncription.EncriptWithPrivateKey(oModel.NewPassword);

                    await _DBUserRepository.Update(oUser).ConfigureAwait(false);

                    result.Stat      = true;
                    result.StatusMsg = "Successfully changed User password";
                }
                else
                {
                    result.StatusMsg = "Old Password not Matched";
                }
            }
            else
            {
                result.StatusMsg = "Not a valid User";
            }

            return(result);
        }
Example #2
0
        public async Task <CommonResponce> ValidateUser(string UserID, string Password)
        {
            bool      isValid  = false;
            LoginUser UserInfo = null;
            var       oUser    = await _DBUserRepository.GetUserByUserID(UserID).ConfigureAwait(false);

            if (oUser != null)
            {
                if (oUser.Password.Equals(_AppEncription.EncriptWithPrivateKey(Password)) && oUser.IsActive.Equals(1) && oUser.IsPassReset.Equals(0))
                {
                    isValid = true;
                }

                UserInfo = _mapper.Map <LoginUser>(oUser);
            }
            CommonResponce result = new CommonResponce
            {
                Stat      = isValid,
                StatusMsg = "",
                StatusObj = UserInfo
            };

            return(result);
        }