Esempio n. 1
0
 /// <summary>
 /// Saves a username and password hash combination to the authentication list.
 /// </summary>
 /// <param name="username">The username to add.</param>
 /// <param name="passHash">The password hash to add.</param>
 /// <param name="saveData">True if the data has to be written to the XML file, false otherwise.</param>
 /// <exception cref="ArgumentNullException"><c>username</c> is null -or- <c>passHash</c> is null.</exception>
 /// <exception cref="ArgumentException">The specified username is invalid.</exception>
 /// <remarks><p>If the user already exists in the collection, the old password hash will be changed to the new one.</p><p>The username 'users' is invalid because it is used internally to store the usernames.</p><p>The password will <em>not</em> be hashed before it is stored in the authentication list. The user must make sure it is a valid MD5 hash.</p></remarks>
 public void SaveUserHash(string username, string passHash, bool saveData)
 {
     if (username == null || passHash == null)
     {
         throw new ArgumentNullException();
     }
     if (username.ToLower() == "users" || username == "")
     {
         throw new ArgumentException();
     }
     UserList.AddHash(username, passHash);
     if (saveData)
     {
         SaveData();
     }
 }