anchor.diff:      AuthorizationHeader = header_value(Req, "Authorization"),
       case AuthorizationHeader of
       "Basic " ++ Base64Value ->
  -        io:format("~n~nBase64Value: '~p'~n~n", [Base64Value]),
           case string:tokens(?b2l(couch_util:decodeBase64(Base64Value)),":") of
           [User, Pass] ->
               {User, Pass};
  
positive.code:                 _P when length(OldPassword) == 0 ->
                      throw({forbidden, <<"Old password is incorrect.">>});
                  _Else ->
                      OldPasswordHash = couch_util:encodeBase64(crypto:sha(<<UserSalt/binary, OldPassword1/binary>>)),
                      ?LOG_DEBUG("~p == ~p", [CurrentPasswordHash, OldPasswordHash]),
                      Hash1 = case CurrentPasswordHash of
                          ExpectedHash when ExpectedHash == OldPasswordHash ->
                              H = couch_util:encodeBase64(crypto:sha(<<UserSalt/binary, Password/binary>>)),
                              H;
                          _ ->
                              throw({forbidden, <<"Old password is incorrect.">>})
  
negative.code:         couch_util:encodeBase64Url(SessionData ++ ":" ++ ?b2l(Hash)),
          [{path, "/"}, {http_only, true}]). % TODO add {secure, true} when SSL is detected
  
  hash_password(Password, Salt) ->
      ?l2b(couch_util:to_hex(crypto:sha(<<Password/binary, Salt/binary>>))).
  
  % Login handler with user db
  handle_login_req(#httpd{method='POST', mochi_req=MochiReq}=Req, #db{}=Db) ->
      ReqBody = MochiReq:recv_body(),
  