nickva commented on code in PR #4814:
URL: https://github.com/apache/couchdb/pull/4814#discussion_r1378976731


##########
src/couch/src/couch_password_hasher.erl:
##########
@@ -21,20 +21,41 @@
     init/1,
     handle_call/3,
     handle_cast/2,
+    handle_info/2,
     code_change/3
 ]).
 
--export([hash/1]).
+-export([maybe_upgrade_password_hash/4, hash_admin_passwords/1]).
 
--record(state, {}).
+-export([worker_loop/1]).
+
+-define(IN_PROGRESS_ETS, couch_password_hasher_in_progress).
+
+-record(state, {
+    worker_pid,
+    worker_mon
+}).
 
 %%%===================================================================
 %%% Public functions
 %%%===================================================================
 
--spec hash(Persist :: boolean()) -> Reply :: term().
-hash(Persist) ->
-    gen_server:cast(?MODULE, {hash_passwords, Persist}).
+maybe_upgrade_password_hash(AuthModule, UserName, Password, UserProps) ->
+    IsAdmin = is_admin(UserProps),
+    NeedsUpgrade = needs_upgrade(UserProps),
+    InProgress = in_progress(AuthModule, UserName),
+    if
+        not IsAdmin andalso NeedsUpgrade andalso not InProgress ->

Review Comment:
   That makes sense. We could put it in a comment in the code perhaps right 
above `maybe_upgrade_password_hash`, just so we if we change the code it 
wouldn't get out of sync with a readme.md file somewhere.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to