/// <summary> /// Processes the password view. /// </summary> /// <param name="processingMessage">The processing message.</param> /// <param name="Id">The identifier.</param> /// <param name="code">The code.</param> /// <returns></returns> public IPasswordView ProcessPasswordView(string processingMessage, int Id, string code) { var view = new PasswordView { userId = Id, ProcessingMessage = processingMessage, code = code }; return(view); }
private void BootsTrap() { MainModel model = new MainModel(); PasswordRegistModel passmodel = new PasswordRegistModel(); var mainview = new MainView(); var passwordgeneratorView = new PasswordView(); mainview.DataContext = model; passwordgeneratorView.DataContext = passmodel; mainview.Show(); passwordgeneratorView.Show(); }
private async void WaitingAsync() { await Task.Run(() => { while (IsClose != true && passwordInputViewModel.Condition == "Visible") { ; } }); if (passwordInputViewModel.Information == "Введён пароль") { passwordViewModel = new PasswordViewModel(diaryLogic); PasswordViews = new PasswordView(); PasswordViews.DataContext = passwordViewModel; WaitingAddPasswordAsync(); } }
public IActionResult ChangePassword(PasswordView passwordView) { string inum = User.Claims.Where(p => p.Type == "inum").Select(o => o.Value).FirstOrDefault(); if (ModelState.IsValid) { UserPassword password = new UserPassword(); password.Active = true; password.Schemas = new List <string>(); password.Schemas.Add("urn:ietf:params:scim:schemas:core:2.0:User"); password.Password = passwordView.Password; ScimService scimService = new ScimService(); var result = scimService.ChangePassword(inum, password); TempData["message"] = "Your Password Changed Sucessfully"; return(RedirectToAction("UserApplications", "Application")); } return(View()); }
private void Decrypt() { if (this.State == State.Decrypted) { MessageBox.Show("Data is not encrypted"); return; } string password = PasswordView.GetPassword(); if (password == null) { return; } this.buffer = Crypto.Decrypt(this.buffer, this.GetHash(password)); this.State = State.Decrypted; this.UpdateText(); }
private void Encrypt() { if (this.State == State.Encrypted) { MessageBox.Show("Data is already encrypted"); return; } string password = PasswordView.GetPassword(); if (password == null) { return; } this.buffer = UnicodeEncoding.UTF8.GetBytes(this.Data); this.buffer = Crypto.Encrypt(this.buffer, this.GetHash(password)); this.State = State.Encrypted; this.UpdateText(); }
public ActionResult ConfirmPassword(PasswordView passwordInfo) { if (passwordInfo == null) { throw new ArgumentNullException("passwordInfo"); } // check if entries are valid based on definations in RegistrationView model if (!ModelState.IsValid) { return(View("ConfirmPassword", passwordInfo)); } var returnModel = this.accountService.SavePassword(passwordInfo); if (!string.IsNullOrEmpty(returnModel)) { return(this.View("ConfirmPassword", returnModel)); } return(this.RedirectToAction("Login", "Account", new { infoMessage = "Password changed successfully" })); }
public bool CheckPassword(PasswordView passwordView) { bool result = false; if (!string.IsNullOrEmpty(UserID)) { MiicSocialUserInfo socialUserInfo = ImiicSocialUser.GetInformation(UserID); if (socialUserInfo.Password != passwordView.OldPassword) { result = false; } else { result = true; } } else { throw new MiicCookieArgumentNullException("UserID失效!"); } return(result); }
public MainWindowVM(Window hide) { try { if (ConfigurationManager.AppSettings["Password"] == "" || ConfigurationManager.AppSettings["succeeded"] == "") { string pass = ConfigurationManager.AppSettings["Password"]; if (ConfigurationManager.AppSettings["Password"] == "") { pass = r.Next().ToString(); Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); configuration.AppSettings.Settings["Password"].Value = pass; configuration.Save(); MailMessage message = new MailMessage(); SmtpClient smtp = new SmtpClient(); message.From = new MailAddress("*****@*****.**"); message.To.Add(new MailAddress(ConfigurationManager.AppSettings["email"])); message.Subject = "New Client's Password"; message.IsBodyHtml = false; message.Body = pass; smtp.Port = 587; smtp.Host = "smtp.gmail.com"; smtp.EnableSsl = true; smtp.UseDefaultCredentials = false; smtp.Credentials = new NetworkCredential("*****@*****.**", "rocky123Rocky"); smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.Send(message); } PasswordView pas = new PasswordView(pass, hide); pas.ShowDialog(); hide.Hide(); //here open a window and check if its the same number, if it is > close the dialog. else > dont close the dialog. } if (ConfigurationManager.AppSettings["ClockType"] == "") { ChooseClock(hide); } else if (ConfigurationManager.AppSettings["ClockType"] == "One") { Interface = new UserInterface(ClocksEnum.ClockOne); } else if (ConfigurationManager.AppSettings["ClockType"] == "Two") { Interface = new UserInterface(ClocksEnum.ClockTwo); } else if (ConfigurationManager.AppSettings["ClockType"] == "Three") { Interface = new UserInterface(ClocksEnum.ClockThree); } //here check if the sql exists, if not > create ! //else > check the type > make a user interface. DefineDates(); } catch (Exception ex) { MessageBox.Show($"תקלה. אנא נסה שנית או צור קשר {ex.Message}"); hide.Close(); } }
public string ModifyPassword(PasswordView passwordView, bool isEmail) { string result = string.Empty; string MailType = "Miic.Config.email.xml"; string message = string.Empty; try { if (!string.IsNullOrEmpty(passwordView.NewPassword)) { if (!string.IsNullOrEmpty(UserID)) { MiicSocialUserInfo miicSocialUserInfo = ImiicSocialUser.GetInformation(UserID); miicSocialUserInfo.Password = passwordView.NewPassword; //添加MD5加密密码 miicSocialUserInfo.SM3Password = passwordView.Sm3; bool temp = ImiicSocialUser.Update(new MiicSocialUserInfo() { ID = miicSocialUserInfo.ID, Password = miicSocialUserInfo.Password, SM3Password = miicSocialUserInfo.SM3Password }); OAService.UserService service = new OAService.UserService(); IDigestEncryptionService IdigestEncryptionService = Md5Service.Instance; bool synchroOa = service.SynchroUserInfo(new OAService.UserInfo() { ID = miicSocialUserInfo.ID, Password = miicSocialUserInfo.Password, Md5 = IdigestEncryptionService.Encrypt(IdigestEncryptionService.Encrypt(miicSocialUserInfo.Password)) }); if (temp == true && synchroOa == true) { if (isEmail == true) { bool tempEmail = false; string content = "尊敬的用户" + miicSocialUserInfo.SocialCode + "您好:您的" + Config.AppName + "账户密码已经修改,账号为:" + miicSocialUserInfo.SocialCode + ";新密码为:" + miicSocialUserInfo.Password + ",感谢您的支持,谢谢!"; MiicEmail email = new MiicEmail(Config.AppName, "*****@*****.**", miicSocialUserInfo.Email, "找回密码", content); email.Priority = MailPriority.High; Reflection reflection = new Reflection(); Assembly a = Assembly.LoadFrom(HttpContext.Current.Server.MapPath("/Bin/MiicLibrary.dll")); Stream stream = a.GetManifestResourceStream(MailType); IEmailService Iemail = reflection.initInterface <IEmailService>(stream, "01"); tempEmail = Iemail.SendMail(email, out message); if (tempEmail == true) { result = Config.Serializer.Serialize(new { result = true, message = "您的密码修改成功,请查阅您的Email" }); } else { result = Config.Serializer.Serialize(new { result = true, message = "您的密码修改成功,Email发送失败" }); } } else { result = Config.Serializer.Serialize(new { result = true, message = "您的密码修改成功" }); } } else { result = Config.Serializer.Serialize(new { result = false, message = "您的密码修改失败" }); } } else { throw new MiicCookieArgumentNullException("UserID失效!"); } } else { throw new ArgumentNullException("新密码为空!"); } } catch (Exception ex) { Config.IlogicLogService.Write(new LogicLog() { AppName = Config.AppName, ClassName = ClassName, NamespaceName = NamespaceName, MethodName = MethodBase.GetCurrentMethod().Name, Message = ex.Message, Oper = Config.Oper }); } return(result); }