anchor.diff:          % Send client an error response, couch_util:send_err ...
           not_implemented;
       {ok, Verified_obj} -> ok
  -        % tilgovi: Set the cookie, send a redirect?
  -        % JasonSmith: Does a bear wear a funny hat?
  -        , ?LOG_DEBUG("Verified:\n~p", [Verified_obj])
  -        , couch_httpd:send_json(Req, 200, {Verified_obj})
  +        , send_good_id(Req, Verified_obj)
       end;
   
   handle_id_req(_Req) ->
  
positive.code:     , couch_httpd_misc_handlers:handle_utils_dir_req(Req, Dir)
      .
  
  % vim: sts=4 sw=4 et
  
negative.code:     end.
  
  
  send_good_id(Req, Verified_obj) -> ok
      , case couch_util:get_value(<<"email">>, Verified_obj)
          of undefined -> ok
              , ?LOG_ERROR("Email address not in verification object: ~p", [Verified_obj])
              , throw({error, bad_verification})
          ; Email -> ok
              , send_good_id(Req, Verified_obj, Email)
          end
      .
  
  send_good_id(Req, Verified_obj, Email) -> ok
      % Set the authenticated session cookie.
      , Secret = ?l2b(ensure_cookie_auth_secret())
  
      % XXX
      , UserSalt = <<"usersalt">>
      , UserName = Email
  
      , CurrentTime = make_cookie_time()
      , Cookie = cookie_auth_cookie(Req, ?b2l(UserName), <<Secret/binary, UserSalt/binary>>, CurrentTime)
      % , ?LOG_INFO("=========\nCookie\n~p", [Cookie])
  
      , Headers = [Cookie]
      , couch_httpd:send_json(Req, 200, Headers, {Verified_obj})
      %, send_json(Req#httpd{req_body=ReqBody}, Code, Headers
      %        {[
      %            {ok, true},
      %            {name, couch_util:get_value(<<"name">>, User, null)},
      %            {roles, couch_util:get_value(<<"roles">>, User, [])}
      %        ]});
      .
  
  
  %
  % Utilities
  %
  