Exemplo n.º 1
0
/*	Username and password
**	---------------------
**	Prompt Username and password as an atomic operation
*/
PUBLIC BOOL HTPromptUsernameAndPassword (HTRequest * request, HTAlertOpcode op,
					 int msgnum, const char * dfault,
					 void * input, HTAlertPar * reply)
{
    BOOL status = HTPrompt(request, op, msgnum, dfault, input, reply);
    return status ?
	HTPromptPassword(request, op, HT_MSG_PW, dfault, input, reply) : NO;
}
Exemplo n.º 2
0
PRIVATE BOOL PromptUsernameAndPassword (HTRequest * request, HTAlertOpcode op,
					int msgnum, const char * dfault,
					void * input, HTAlertPar * reply)
{
    ComLine * cl = (ComLine *) HTRequest_context(request);
    char * realm = (char *) input;
    if (request && cl) {

	/*
	**  If we have a realm then check that it matches the realm
	**  that we got from the server.
	*/
	if (realm && cl->realm && !strcmp(cl->realm, realm)) {
	    HTAlert_setReplyMessage(reply, cl->user ? cl->user : "");
	    HTAlert_setReplySecret(reply, cl->password ? cl->password : "");
	    return YES;
	} else {
	    BOOL status = HTPrompt(request, op, msgnum, dfault, input, reply);
	    return status ?
		HTPromptPassword(request, op, HT_MSG_PW, dfault, input, reply) : NO;
	}
    }
    return NO;
}