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)); }
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); }
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); }