コード例 #1
0
 public User(string login, string pass, Roles role = 0)
 {
     LoginFormValidator.Validate(login, pass);
     Login    = login;
     Password = pass;
     Role     = role;
 }
コード例 #2
0
        static IUserInternal LoginUi()
        {
            IUserInternal user = null;
            string        password;

            for (int i = 0; i < 3; i++)
            {
                Console.Write("username:"******"password:"******"username or password is incorrect");
                    continue;
                }
                else
                {
                    break;
                }
            }
            if (user is null)
            {
                Console.WriteLine("failed to login");
            }
            return(user);
        }
コード例 #3
0
        static void ChangePasswordForm(IUser user)
        {
            if (user is null)
            {
                throw new ArgumentNullException(nameof(user));
            }
            Console.WriteLine($"change password for user: {user.Login}");
            string password = string.Empty;
            string repeat   = string.Empty;

            for (int i = 0; i < 3; i++)
            {
                Console.Write("new password:"******"repeat password:"******"passwords not same");
                }
            }
            try{
                LoginFormValidator.Validate(user.Login, password);
            }catch (System.Exception e) {
                Console.WriteLine(e.Message);
                Console.WriteLine("failed to change password");
                return;
            }
            ChangePassword(user, password);
            Console.WriteLine("password changed");
        }