Exemplo n.º 1
0
        public string ValidatePassword(string password, string userData)
        {
            PasswordOptions options;
            string          message;

            options = OptionsAgent.Get <PasswordOptions>(PasswordOptionsPresenter.PasswordOptions, new PasswordOptions());
            if (!PasswordValidator.Validate(password, password, options, out message))
            {
                return(message);
            }

            return(string.Empty);
        }
Exemplo n.º 2
0
        public bool ResetPassword(string username, string newPassowrd, string userData)
        {
            PasswordOptions options;
            DateTime?       expires = null;

            options = OptionsAgent.Get <PasswordOptions>(PasswordOptionsPresenter.PasswordOptions, new PasswordOptions());
            if (options.DaysToExpire > 0)
            {
                expires = DateTime.Now.AddDays(options.DaysToExpire);
            }

            return(UserManagementAgent.SetUserPassword(username, ToSecureString(newPassowrd), expires, options.MaxPasswordHistory));
        }
Exemplo n.º 3
0
        public void CreateUser(string authUser, string username, string password, string userType, DateTime?expires)
        {
            User[]          users = UserManagementAgent.GetUsers();
            PasswordOptions options;

            if (expires == null)
            {
                options = OptionsAgent.Get <PasswordOptions>(PasswordOptionsPresenter.PasswordOptions, new PasswordOptions());
                if (options.DaysToExpire > 0)
                {
                    expires = DateTime.Now.AddDays(options.DaysToExpire);
                }
            }

            if (UserManagementAgent.UserExists(username))
            {
                throw new Exception("User already exist.");
            }

            UserManagementAgent.AddUser(username, string.Empty, ToSecureString(password), expires, userType);
            LoggingAgent.AddUser(authUser, username);
        }
Exemplo n.º 4
0
 public static void SetDefaultOptions()
 {
     OptionsAgent.SaveDefaultOptions(MedicalOptions);
 }