anchor.diff:                  throw({forbidden, <<"Name or password is incorrect.">>})
               end
           end,
  -        Secret = ?l2b(couch_config:get("chttpd_auth", "secret")),
  +        Secret = ?l2b(couch_config:get("couch_httpd_auth", "secret")),
           SecretAndSalt = <<Secret/binary, UserSalt/binary>>,
           Cookie = generate_cookie(UserName, SecretAndSalt, timestamp()),
           send_response(Req, [Cookie])
  
positive.code:                 true ->
                      TimeStamp = erlang:list_to_integer(TimeStr, 16),
                      Timeout = erlang:list_to_integer(couch_config:get(
                          "chttpd_auth", "timeout", "600")),
                      CurrentTime = timestamp(),
                      if CurrentTime < TimeStamp + Timeout ->
                          TimeLeft = TimeStamp + Timeout - CurrentTime,
  
negative.code:     SessionData = ?b2l(User) ++ ":" ++ erlang:integer_to_list(TimeStamp, 16),
      Hash = crypto:sha_mac(Secret, SessionData),
      Cookie = couch_util:encodeBase64Url(SessionData ++ ":" ++ ?b2l(Hash)),
      % TODO add {secure, true} to options when SSL is detected
      mochiweb_cookies:cookie("AuthSession", Cookie, [{path, "/"}]).
  
  hash_password(Password, Salt) ->
      ?l2b(couch_util:to_hex(crypto:sha(<<Password/binary, Salt/binary>>))).
  