private void Registration() { var validatorLoginRegist = new ValidatorLoginRegist(); var validatorPasswordRegist = new ValidatorPasswordRegist(); var validatorName = new ValidatorName(); Console.WriteLine("Create your Login (It should be begger than 4 letter)"); Login = ReadString.FromConsole(validatorLoginRegist); Console.WriteLine("Create your Password (It should be begger than 6 letter)"); Password = ReadString.FromConsole(validatorPasswordRegist); Console.WriteLine("Enter your name"); Name = ReadString.FromConsole(validatorName); }
private void RestorePassword() { var validatorName = new ValidatorName(); var validatorLogIn = new ValidatorLoginLogIn(); var validatorPasswordRegist = new ValidatorPasswordRegist(); Console.Clear(); Console.WriteLine("Enter your Login"); Login = ReadString.FromConsole(validatorLogIn); var user = UserRepo.Get(Login); Console.WriteLine("Enter Name, that you enter when you register"); int count = 1; while (count <= Try) { var name = ReadString.FromConsole(validatorName); if (name == user.Name) { Console.WriteLine("Enter new password"); Password = ReadString.FromConsole(validatorPasswordRegist); user.Password = Password; UserRepo.Save(user); break; } else { if (Try != count) { Console.WriteLine($"Check correction of Name. You still have {Try - count} attempts."); } count++; } } Console.Clear(); }