SOL9 Sample: CredentialsPrompt

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * CredentialsPrompt.cpp 
 * Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


// SOL9
// 2009/04/10

#include <sol/CredentialsPrompt.h>

void _tmain(int argc, TCHAR** argv)
{ 
  CredentialsPrompt prompt;
  {
    //Use empty username and password strings.
    String username;
    String password;
    int rc = 0;

    _tprintf(_T("Please input username in the format \"domain\\someone\" or \"someone@foo.com\"\n"));

    if ((rc =prompt.show(username, password, _T("Somewhere Server"))) == NO_ERROR) {
      _tprintf(_T("Username = %s\n"), (const TCHAR*)username);
      _tprintf(_T("Password = %s\n"), (const TCHAR*)password);
      username.secureClear();
      password.secureClear();
    } else {
      _tprintf(_T("Error rc = %x\n"), rc);
    }
  }

  {

    //Use non-empty default username and password strings. 
    String username = _T("FoolDomain\\User");
    String password = _T("1%$QweU9?[KL}");
    int rc = 0;
    if ((rc = prompt.show(username, password, _T("FooDomain"))) == NO_ERROR) {
      _tprintf(_T("Username = %s\n"), (const TCHAR*)username);
      _tprintf(_T("Password = %s\n"), (const TCHAR*)password);
      username.secureClear();
      password.secureClear();
    } else {
      _tprintf(_T("Error rc = %x\n"), rc);
    }

  }
}

Last modified: 2 May 2016

Copyright (c) 2016 Antillia.com ALL RIGHTS RESERVED.