anchor.diff:    Password: string;
   begin
     // read form data
  -  Username := Utf8ToString(RawByteString(Request.Params.Values['username']));
  -  Password := Utf8ToString(RawByteString(Request.Params.Values['password']));
  +  Username := Request.Params.Values['username'];
  +  Password := Request.Params.Values['password'];
   
     if CheckPwd(Username, Password) then
     begin
  
positive.code:   else
    begin
      // respond with logout form
      Response.ContentText := '<!DOCTYPE html>' + #13
      + '<html lang="en">' + #13
      + '  <head>' + #13
      + '    <title>Form based login example</title>' + #13
      + '  </head>' + #13
      + '  <body>' + #13
      + '    <p>you are logged in</p>' + #13
      + '    <form method="post" action="logout">' + #13
      + '     <input type="submit" value="Logout">' + #13
      + '    </form>' + #13
      + '  </body>' + #13
      + '</html>';
    end;
  
    Response.ContentType := 'text/html';
  
negative.code: 
  implementation
  
  uses SysUtils;
  
  procedure TLoginResource.OnGet(Request: TdjRequest; Response: TdjResponse);
  var
    User: string;
  begin
    User := Request.Session.Content.Values['auth:username'];
    if User = '' then
    begin
      // respond with login form
      Response.ContentText :=
        '<!DOCTYPE html>' + #13
      + '<html lang="en">' + #13
      + '  <head>' + #13
      + '    <meta charset="utf-8">' + #13
      + '    <title>Form based login example</title>' + #13
      + '  </head>' + #13
      + '  <body>' + #13
  