mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-26 22:09:43 +03:00
Do not uses windom functions for the login dialog.
This commit is contained in:
parent
ec0c68503d
commit
e7329e1129
@ -21,7 +21,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <windom.h>
|
#include <cflib.h>
|
||||||
#include "utils/config.h"
|
#include "utils/config.h"
|
||||||
#include "content/content.h"
|
#include "content/content.h"
|
||||||
#include "content/hlcache.h"
|
#include "content/hlcache.h"
|
||||||
@ -36,77 +36,39 @@
|
|||||||
#include "utils/url.h"
|
#include "utils/url.h"
|
||||||
#include "content/urldb.h"
|
#include "content/urldb.h"
|
||||||
#include "content/fetch.h"
|
#include "content/fetch.h"
|
||||||
|
#include "atari/misc.h"
|
||||||
#include "atari/login.h"
|
#include "atari/login.h"
|
||||||
#include "atari/res/netsurf.rsh"
|
#include "atari/res/netsurf.rsh"
|
||||||
|
|
||||||
|
|
||||||
extern void * h_gem_rsrc;
|
bool login_form_do(nsurl * url, char * realm, char ** out)
|
||||||
|
|
||||||
bool login_form_do( nsurl * url, char * realm, char ** out )
|
|
||||||
{
|
{
|
||||||
OBJECT *tree, *newtree;
|
|
||||||
WINDOW * form;
|
|
||||||
char user[255];
|
char user[255];
|
||||||
char pass[255];
|
char pass[255];
|
||||||
bool bres = false;
|
//const char * auth;
|
||||||
int res = 0;
|
short exit_obj = 0;
|
||||||
const char * auth;
|
OBJECT * tree;
|
||||||
lwc_string * host = nsurl_get_component(url, NSURL_HOST);
|
|
||||||
assert(host != NULL);
|
|
||||||
|
|
||||||
if( realm == NULL ){
|
|
||||||
realm = (char*)"Secure Area";
|
|
||||||
}
|
|
||||||
|
|
||||||
int len = strlen(realm) + lwc_string_length(host) + 4;
|
|
||||||
char * title = malloc( len );
|
|
||||||
strncpy(title, realm, len );
|
|
||||||
strncpy(title, ": ", len-strlen(realm) );
|
|
||||||
strncat(title, lwc_string_data(host), len-strlen(realm)+2 );
|
|
||||||
|
|
||||||
lwc_string_unref(host);
|
|
||||||
|
|
||||||
auth = urldb_get_auth_details(url, realm);
|
|
||||||
user[0] = 0;
|
user[0] = 0;
|
||||||
pass[0] = 0;
|
pass[0] = 0;
|
||||||
/*
|
|
||||||
TODO: use auth details if available:
|
|
||||||
if( auth == NULL ){
|
|
||||||
|
|
||||||
} else {
|
// TODO: use auth details for predefined login data
|
||||||
|
// auth = urldb_get_auth_details(url, realm);
|
||||||
|
tree = get_tree(LOGIN);
|
||||||
|
|
||||||
}*/
|
assert(tree != NULL);
|
||||||
|
|
||||||
RsrcGaddr (h_gem_rsrc , R_TREE, LOGIN, &tree);
|
exit_obj = simple_mdial(tree, 0);
|
||||||
ObjcChange( OC_OBJC, tree, LOGIN_BT_LOGIN, 0, 0 );
|
|
||||||
ObjcChange( OC_OBJC, tree, LOGIN_BT_ABORT, 0, 0 );
|
|
||||||
ObjcString( tree, LOGIN_TB_USER, (char*)&user );
|
|
||||||
ObjcString( tree, LOGIN_TB_PASSWORD, (char*)&pass );
|
|
||||||
form = FormWindBegin( tree, (char *)title );
|
|
||||||
res = -1;
|
|
||||||
while( res != LOGIN_BT_LOGIN && res != LOGIN_BT_ABORT ){
|
|
||||||
res = FormWindDo( MU_MESAG );
|
|
||||||
switch( res ){
|
|
||||||
case LOGIN_BT_LOGIN:
|
|
||||||
bres = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LOGIN_BT_ABORT:
|
if(exit_obj == LOGIN_BT_LOGIN) {
|
||||||
bres = false;
|
get_string(tree, LOGIN_TB_USER, user);
|
||||||
break;
|
get_string(tree, LOGIN_TB_PASSWORD, pass);
|
||||||
}
|
int size = strlen((char*)&user) + strlen((char*)&pass) + 2 ;
|
||||||
}
|
*out = malloc(size);
|
||||||
|
snprintf(*out, size, "%s:%s", user, pass);
|
||||||
if( bres ) {
|
|
||||||
*out = malloc(strlen((char*)&user) + strlen((char*)&pass) + 2 );
|
|
||||||
strcpy(*out, (char*)&user);
|
|
||||||
strcat(*out, ":");
|
|
||||||
strcat(*out, (char*)&pass);
|
|
||||||
} else {
|
} else {
|
||||||
*out = NULL;
|
*out = NULL;
|
||||||
}
|
}
|
||||||
|
return((exit_obj == LOGIN_BT_LOGIN));
|
||||||
FormWindEnd( );
|
|
||||||
free( title );
|
|
||||||
return( bres );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
@ -3,7 +3,7 @@ ResourceMaster v3.65
|
|||||||
#N 99@32@AZAaza___ _@AZAaza090___ _@@_@
|
#N 99@32@AZAaza___ _@AZAaza090___ _@@_@
|
||||||
#FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@
|
#FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@
|
||||||
#R 0@0@1@1@1@1@
|
#R 0@0@1@1@1@1@
|
||||||
#M 20010100@0@7728@622@
|
#M 20010100@0@7728@623@
|
||||||
#T 0@1@MAINMENU@@62@@
|
#T 0@1@MAINMENU@@62@@
|
||||||
#O 4@32@T_FILE@@
|
#O 4@32@T_FILE@@
|
||||||
#O 5@32@T_EDIT@@
|
#O 5@32@T_EDIT@@
|
||||||
@ -198,4 +198,4 @@ ResourceMaster v3.65
|
|||||||
#O 5@33@BT_DOWN_PIC@@
|
#O 5@33@BT_DOWN_PIC@@
|
||||||
#O 6@25@BT_UP@@
|
#O 6@25@BT_UP@@
|
||||||
#O 4@33@BT_UP_PIC@@
|
#O 4@33@BT_UP_PIC@@
|
||||||
#c 780@
|
#c 32640@
|
||||||
|
Loading…
Reference in New Issue
Block a user