diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2012-10-03 19:08:47 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2012-10-03 19:08:47 +0200 |
commit | 14fc4fbdf59efc5626b5508780ebe3477cc9366a (patch) | |
tree | 1f36b72022c24d406f95dc5bc7d27992c68289e3 /www/login.pl | |
parent | 08b9ee11fe5e5a54af866a061c9e8d7782cac3c7 (diff) |
Make the configuration map a dynamic variable.
Diffstat (limited to 'www/login.pl')
-rwxr-xr-x | www/login.pl | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/www/login.pl b/www/login.pl index 9f6831d..9e0467e 100755 --- a/www/login.pl +++ b/www/login.pl @@ -16,14 +16,14 @@ use Mail::IMAPTalk ; do "common.pl"; -sub check_password($$$) { - my ($config, $user, $password) = @_; +sub check_password($$) { + my ($user, $password) = @_; #my $socket = IO::Socket::SSL->new('imap.googlemail.com:imaps'); my $imap = Mail::IMAPTalk->new( # Socket => $socket, - Server => $config->{imap_server}, - Port => $config->{imap_port}, + Server => $::MULKONF->{imap_server}, + Port => $::MULKONF->{imap_port}, Username => $user, Password => $password, Uid => 1 @@ -38,8 +38,7 @@ sub check_password($$$) { while (my $cgi = new CGI::Fast) { - local $::MULKONF = { }; - do "config.pl"; + load_config(); my $cookie = $cgi->cookie('mulkid_session'); my $session; @@ -62,9 +61,9 @@ while (my $cgi = new CGI::Fast) { my $email = $cgi->param('email') or die "No email address provided"; my $password = $cgi->param('password') or die "Empty password"; - for my $user (email_users($::MULKONF, $email)) { + for my $user (email_users($email)) { #say STDERR "Trying user: $user"; - if (check_password($::MULKONF, $user, $password)) { + if (check_password($user, $password)) { $session->param('user', $user); say encode_json({user => $user}); exit 0; |