summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmdkonline45
1 files changed, 33 insertions, 12 deletions
diff --git a/mdkonline b/mdkonline
index ea5ce2ea..6eb39e21 100755
--- a/mdkonline
+++ b/mdkonline
@@ -29,6 +29,7 @@ init Gtk;
Gtk->set_locale;
#use strict;
use MDK::Common;
+use Digest::MD5 qw(md5 md5_hex md5_base64);
my $in = 'interactive'->vnew('su', 'default');
@@ -49,7 +50,7 @@ sub translate {
$s ? c::dgettext('mdkonline', $s) : '';
}
-my $authentication_host = "bi";
+my $authentication_host = "http://www.mandrakeexpert.com/firsttimewizard/validusercheck.php";
my $nb_pages=6; # 0 to 5
my $page;
@@ -201,24 +202,44 @@ sub subscribe_mdkonline() {
sub test_passwd () {
my $current_page = shift;
+ my $result = -1;
-# print STDERR "Testing passwd\n";
-
- # test the password
$login = $login_user->get_text();
$passwd = $passwd_user->get_text();
-# print STDERR "Login: $login\n";
- my $ssh_script = "";
- foreach ("/usr/bin/sshlogin.exp","./sshlogin.exp") {
- [ -e "$_" ] and $ssh_script="$_", last;
- }
+# OLD METHOD, keep it for next version ?...
+# my $ssh_script = "";
+# foreach ("/usr/bin/sshlogin.exp","./sshlogin.exp") {
+# [ -e "$_" ] and $ssh_script="$_", last;
+# }
# print "Exec: $ssh_script $login $authentication_host $passwd \n";
# TODO: beware if the script was not found
- `$ssh_script $login $authentication_host $passwd`;
+# `$ssh_script $login $authentication_host $passwd`;
+
+# NEW METHOD (http)
+ # first, MD5ify the password
+ $passwd = md5 ($passwd); # or md5_hex () or md5_base64 ()
+
+ require HTTP::Request;
+ require LWP::UserAgent;
+ my $ua = LWP::UserAgent->new;
+# TEST URL
+ print STDERR "Real url should be: $authentication_host?u=$login&p=$passwd \n";
+ my $request = HTTP::Request->new(GET => 'http://www.mandrakeexpert.com/firsttimewizard/validusercheck.php?u=mark&p=26bdb06eabafac3aea95991149dd8ea9');
+# REAL ONE
+# my $request = HTTP::Request->new(GET => '$authentication_host?u=$login&p=$passwd');
+ my $response = $ua->request($request);
+ # Check the outcome of the response
+ if ($response->is_success) {
+ $result = ($response->content =~ /TRUE/) ? 0 : -1;
+ } else {
+ # pb with the connection ?
+ info_popup (_("Connection problem"), _("MandrakeOnline could not be contacted, please try again at a later time"));
+ return;
+ }
- # if correct (exit code: 0 from ssh script), go to page 4
- if (! $?) {
+ # if correct, go to page 4
+ if (! $result) {
$notebook_global->next_page();
} else {
# if incorrect, clear passwd and stay on page 2