Пример #1
0
 public IHttpActionResult ResetPassword(string id, PasswordConfirmation password)
 {
     try
     {
         id = Encode.Base64Decode(id);
         string message = VerifyPasswords.Password(password);
         if (message == "Successfull")
         {
             DBOperations.SaveChangedPassword(password, id);
             return(Ok("Password Changed Successfully"));
         }
         else if (message == "Passswords Don't Match")
         {
             return(Ok("Passswords Don't Match"));
         }
         else
         {
             return(Ok("Password Change Not Successful"));
         }
     }
     catch (Exception ex)
     {
         LogFile.WriteLog(ex);
         return(BadRequest());
     }
 }
Пример #2
0
        public IHttpActionResult VerifyEmployee(string id, PasswordConfirmation password)
        {
            string message = VerifyPasswords.Password(password);

            if (message == "Successfull")
            {
                CallStoredProc.RunAddUserInfo(password, id);
                return(Ok("Verified Successfully"));
            }
            else
            {
                return(Ok("Verification Not Successful"));
            }
        }
Пример #3
0
        public LoginWindow()
        {
            InitializeComponent();
            LoginWindowViewModel loginViewModel = new LoginWindowViewModel();

            loginViewModel.MessageBoxDisplayRequested += (sender, e) =>
            {
                CustomMessageBox.Show(e.MessageBoxText, e.Caption);
            };
            loginViewModel.CloseDialogRequested         += result => DialogResult = result;
            loginViewModel.ClearPasswordFieldsRequested += () =>
            {
                Password.Clear();
                PasswordConfirmation.Clear();
            };
            DataContext = loginViewModel;
        }
Пример #4
0
        public IHttpActionResult ResetPassword(string id, PasswordConfirmation password)
        {
            string message = VerifyPasswords.Password(password);

            if (message == "Successfull")
            {
                DBOperations.SaveChangedPassword(password, id);
                return(Ok("Password Changed Successfully"));
            }
            else if (message == "Passswords Don't Match")
            {
                return(Ok("Passswords Don't Match"));
            }
            else
            {
                return(Ok("Password Change Not Successful"));
            }
        }
Пример #5
0
        public IEnumerable <ModelValidationResult> Validate()
        {
            if (Name.IsNullOrEmpty())
            {
                yield return(new ModelValidationResult(nameof(Name), "Введите имя"));
            }
            if (Password.IsNullOrEmpty() && PasswordConfirmation.IsNullOrEmpty())
            {
                yield break;
            }
            if (Password == PasswordConfirmation)
            {
                yield break;
            }
            const string message = "Пароль и подтверждение должны совпадать";

            yield return(new ModelValidationResult(nameof(Password), message));

            yield return(new ModelValidationResult(nameof(PasswordConfirmation), message));
        }
Пример #6
0
 public IHttpActionResult VerifyEmployee(string id, PasswordConfirmation password)
 {
     try
     {
         id = Encode.Base64Decode(id);
         string message = VerifyPasswords.Password(password);
         if (message == "Successfull")
         {
             CallStoredProc.RunAddUserInfo(password, id);
             return(Ok("Verified Successfully"));
         }
         else
         {
             return(Ok("Verification Not Successful"));
         }
     }
     catch (Exception ex)
     {
         LogFile.WriteLog(ex);
         return(BadRequest());
     }
 }
Пример #7
0
        public async Task <ActionResult> PasswordReset(PasswordConfirmation entidad)
        {
            if (ModelState.IsValid)
            {
                Usuario aux = new Usuario();
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(_baseurl);
                    client.DefaultRequestHeaders.Clear();
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    HttpResponseMessage res = await client.GetAsync("api/Usuario/GetOneByString/5?id=" + Session["Usuario"]);

                    if (res.IsSuccessStatusCode)
                    {
                        var auxRes = res.Content.ReadAsStringAsync().Result;
                        aux            = JsonConvert.DeserializeObject <Usuario>(auxRes);
                        aux.IsTemp     = false;
                        aux.LoginCount = 0;
                        aux.Contrasena = Cryptography.Encrypt(entidad.Contrasena);
                        var myContent   = JsonConvert.SerializeObject(aux);
                        var buffer      = Encoding.UTF8.GetBytes(myContent);
                        var byteContent = new ByteArrayContent(buffer);
                        byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                        var postTask = client.PostAsync("api/Usuario/Update", byteContent).Result;
                        var result   = postTask;
                        Session["Usuario"] = aux.Usuario1;
                        Session["Tipo"]    = aux.IdTipoUsuario;
                        if (result.IsSuccessStatusCode)
                        {
                            return(RedirectToAction("", ""));
                        }
                    }
                }
            }
            return(View());
        }
Пример #8
0
        public override bool Collect(AbstractDataCollector <TEntity> collector)
        {
            if (collector == null)
            {
                return(false);
            }

            ActiveCollector = collector;

            if (Password == null || PasswordConfirmation == null || Password.ToString() != PasswordConfirmation.ToString())
            {
                return(false);
            }

            ID = ((IUserViewer)ActiveCollector.ActiveViewer).ID;

            if (ActiveDBItem == null)
            {
                return(false);
            }

            if (FirstName != null)
            {
                ((Person_cu)ActiveDBItem).FirstName_P = FirstName.ToString();
            }

            if (SecondName != null)
            {
                ((Person_cu)ActiveDBItem).SecondName_P = SecondName.ToString();
            }

            if (ThirdName != null)
            {
                ((Person_cu)ActiveDBItem).ThirdName_P = ThirdName.ToString();
            }

            if (FourthName != null)
            {
                ((Person_cu)ActiveDBItem).FourthName_P = FourthName.ToString();
            }

            if (MaritalStatus != null)
            {
                ((Person_cu)ActiveDBItem).MaritalStatus_P_ID = Convert.ToInt32(MaritalStatus);
            }

            if (Gender != null)
            {
                ((Person_cu)ActiveDBItem).Gender = Convert.ToBoolean(Gender);
            }

            if (BirthDate != null)
            {
                ((Person_cu)ActiveDBItem).BirthDate = Convert.ToDateTime(BirthDate);
            }

            if (Mobile1 != null)
            {
                ((Person_cu)ActiveDBItem).Mobile1 = Mobile1.ToString();
            }

            if (Mobile2 != null)
            {
                ((Person_cu)ActiveDBItem).Mobile2 = Mobile2.ToString();
            }

            if (Phone1 != null)
            {
                ((Person_cu)ActiveDBItem).Phone1 = Phone1.ToString();
            }

            if (Phone2 != null)
            {
                ((Person_cu)ActiveDBItem).Phone2 = Phone2.ToString();
            }

            if (Address != null)
            {
                ((Person_cu)ActiveDBItem).Address = Address.ToString();
            }

            if (Email != null)
            {
                ((Person_cu)ActiveDBItem).EMail = Email.ToString();
            }

            if (IdentificationCardType != null)
            {
                ((Person_cu)ActiveDBItem).IdentificationCardType_P_ID = Convert.ToInt32(IdentificationCardType);
            }

            if (IdentificationCardNumber != null)
            {
                ((Person_cu)ActiveDBItem).IdentificationCardNumber = IdentificationCardNumber.ToString();
            }

            if (IdentificationCardIssueDate != null)
            {
                ((Person_cu)ActiveDBItem).IdentificationCardIssuingDate = Convert.ToDateTime(IdentificationCardIssueDate);
            }

            if (IdentificationCardExpirationDate != null)
            {
                ((Person_cu)ActiveDBItem).IdentificationCardExpirationDate = Convert.ToDateTime(IdentificationCardExpirationDate);
            }

            if (((Person_cu)ActiveDBItem).User_cu == null)
            {
                ((Person_cu)ActiveDBItem).User_cu = new User_cu();
            }

            if (InternalCode != null)
            {
                ((Person_cu)ActiveDBItem).User_cu.InternalCode = InternalCode.ToString();
            }

            if (LoginName != null)
            {
                ((Person_cu)ActiveDBItem).User_cu.LoginName = LoginName.ToString();
            }

            ((Person_cu)ActiveDBItem).User_cu.OragnizationID = (int)ApplicationStaticConfiguration.Organization;

            ((Person_cu)ActiveDBItem).User_cu.Password = Password.ToString();

            ((Person_cu)ActiveDBItem).IsOnDuty         = true;
            ((Person_cu)ActiveDBItem).User_cu.IsOnDuty = true;
            switch (((IUserViewer)ActiveCollector.ActiveViewer).CommonTransactionType)
            {
            case DB_CommonTransactionType.DeleteExisting:
                ((Person_cu)ActiveDBItem).IsOnDuty         = false;
                ((Person_cu)ActiveDBItem).User_cu.IsOnDuty = false;
                break;
            }

            RelatedViewers = ((IUserViewer)ActiveCollector.ActiveViewer).RelatedViewers;

            return(true);
        }