anchor.diff:  maybe_value(Key, Else, Fun) ->
       [{Key, Fun(Else)}].
   
  -maybe_upgrade_password_hash(Req, UserName, Password, UserProps,
  -        AuthModule, AuthCtx) ->
  -    IsAdmin = lists:member(<<"_admin">>, couch_util:get_value(<<"roles">>, UserProps, [])),
  -    case {IsAdmin, couch_util:get_value(<<"password_scheme">>, UserProps, <<"simple">>)} of
  -    {false, <<"simple">>} ->
  -        UserProps2 = proplists:delete(<<"password_sha">>, UserProps),
  -        UserProps3 = [{<<"password">>, Password} | UserProps2],
  -        NewUserDoc = couch_doc:from_json_obj({UserProps3}),
  -        ok = AuthModule:update_user_creds(Req, NewUserDoc, AuthCtx),
  -        {ok, NewUserProps, _} = AuthModule:get_user_creds(Req, UserName),
  -        NewUserProps;
  -    _ ->
  -        UserProps
  -    end.
  -
   authenticate(Pass, UserProps) ->
       UserSalt = couch_util:get_value(<<"salt">>, UserProps, <<>>),
       {PasswordHash, ExpectedHash} =
  
positive.code:                 Password = ?l2b(Pass),
                  case authenticate(Password, UserProps) of
                      true ->
                          UserProps2 = maybe_upgrade_password_hash(
                              Req, UserName, Password, UserProps,
                              AuthModule, AuthCtx),
                          Req#httpd{user_ctx=#user_ctx{
                              name=UserName,
                              roles=couch_util:get_value(<<"roles">>, UserProps2, [])
                          }};
                      false ->
                          authentication_warning(Req, UserName),
  
negative.code:                 {[
                      {ok, true},
                      {name, UserName},
                      {roles, couch_util:get_value(<<"roles">>, UserProps, [])}
                  ]});
          false ->
              authentication_warning(Req, UserName),
  