@@ -53,7 +53,7 @@ public void CreateUser(string username, string password, bool canCreateUsers = f
5353 if ( password == null )
5454 throw new ArgumentNullException ( "password" ) ;
5555
56- if ( ! createUser ( username , createHash ( password ) , canCreateUsers ) )
56+ if ( ! TryCreateUser ( username , createHash ( password ) , canCreateUsers ) )
5757 throw new InvalidOperationException ( "The specified user already exists." ) ;
5858 }
5959
@@ -71,7 +71,7 @@ public void CreateUser(string username, string password, bool canCreateUsers = f
7171 /// <remarks>
7272 /// If the user does not exist, the overridden method must return <c>false</c> and not modify <paramref
7373 /// name="username"/>.</remarks>
74- protected abstract bool getUser ( ref string username , out string passwordHash , out bool canCreateUsers ) ;
74+ protected abstract bool GetUser ( ref string username , out string passwordHash , out bool canCreateUsers ) ;
7575
7676 /// <summary>
7777 /// When overridden in a derived class, attempts to change a user’s password.</summary>
@@ -85,7 +85,7 @@ public void CreateUser(string username, string password, bool canCreateUsers = f
8585 /// <c>true</c> if the password was successfully changed; <c>false</c> if the specified user does not exist or
8686 /// <paramref name="verifyOldPasswordHash"/> returned <c>false</c> indicating that the old password hash turned
8787 /// out to be invalid.</returns>
88- protected abstract bool changePassword ( string username , string newPasswordHash , Func < string , bool > verifyOldPasswordHash ) ;
88+ protected abstract bool ChangePassword ( string username , string newPasswordHash , Func < string , bool > verifyOldPasswordHash ) ;
8989
9090 /// <summary>
9191 /// When overridden in a derived class, creates a new user.</summary>
@@ -97,7 +97,7 @@ public void CreateUser(string username, string password, bool canCreateUsers = f
9797 /// Specifies whether the new user has the right to create new users.</param>
9898 /// <returns>
9999 /// <c>true</c> if a new user was created; <c>false</c> if <paramref name="username"/> is already taken.</returns>
100- protected abstract bool createUser ( string username , string passwordHash , bool canCreateUsers ) ;
100+ protected abstract bool TryCreateUser ( string username , string passwordHash , bool canCreateUsers ) ;
101101
102102 private HttpResponse logoutHandler ( HttpRequest req , Action < string > setUsername )
103103 {
@@ -117,7 +117,7 @@ private HttpResponse loginHandler(HttpRequest req, Action<string> setUsername)
117117 if ( username == null || password == null )
118118 return HttpResponse . Redirect ( req . Url . WithQuery ( "returnto" , returnTo ) ) ;
119119
120- if ( getUser ( ref username , out var passwordHash , out var canCreateUsers ) && verifyHash ( password , passwordHash ) )
120+ if ( GetUser ( ref username , out var passwordHash , out var canCreateUsers ) && verifyHash ( password , passwordHash ) )
121121 {
122122 // Login successful!
123123 setUsername ( username ) ;
@@ -147,7 +147,7 @@ private HttpResponse changePasswordHandler(HttpRequest req, string loggedInUser)
147147 if ( newpassword2 != newpassword )
148148 return changePasswordForm ( loggedInUser , returnTo , false , true , oldpassword , newpassword , newpassword2 , req . Url . WithoutQuery ( "returnto" ) ) ;
149149
150- if ( ! changePassword ( loggedInUser , createHash ( newpassword ) , h => verifyHash ( oldpassword , h ) ) )
150+ if ( ! ChangePassword ( loggedInUser , createHash ( newpassword ) , h => verifyHash ( oldpassword , h ) ) )
151151 return changePasswordForm ( loggedInUser , req . Url [ "returnto" ] , true , false , oldpassword , newpassword , newpassword2 , req . Url . WithoutQuery ( "returnto" ) ) ;
152152
153153 return HttpResponse . Redirect ( returnTo ?? _defaultReturnTo ( req . Url ) ) ;
@@ -167,14 +167,14 @@ private HttpResponse createUserHandler(HttpRequest req, string loggedInUserName)
167167 // if returnTo is null, this removes the query parameter
168168 return HttpResponse . Redirect ( req . Url . WithQuery ( "returnto" , returnTo ) ) ;
169169
170- if ( ! getUser ( ref loggedInUserName , out var passwordHash , out var canCreateUsers ) || ! canCreateUsers )
170+ if ( ! GetUser ( ref loggedInUserName , out var passwordHash , out var canCreateUsers ) || ! canCreateUsers )
171171 throw new HttpException ( HttpStatusCode . _401_Unauthorized ) ;
172172
173173 if ( newpassword2 != newpassword )
174174 // Passwords don’t match.
175175 return createUserForm ( returnTo , false , true , username , newpassword , newpassword2 , req . Url . WithoutQuery ( "returnto" ) ) ;
176176
177- if ( ! createUser ( username , createHash ( newpassword ) , false ) )
177+ if ( ! TryCreateUser ( username , createHash ( newpassword ) , false ) )
178178 // The user already exists.
179179 return createUserForm ( returnTo , true , false , username , newpassword , newpassword2 , req . Url . WithoutQuery ( "returnto" ) ) ;
180180
0 commit comments