X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;ds=sidebyside;f=aux%2Fcgi%2Femail.cgi;h=62c717d2fc38fe087322356d97d7ea286a1c84d2;hb=97cbb6cd2640bc3a0528dadb1730840ccae503c0;hp=0d128b9591778ad06aae82cbab1a0e1d80502d7b;hpb=b152c3c669d496cc576b11bb04d71f9f492b2b8d;p=blerg.git diff --git a/aux/cgi/email.cgi b/aux/cgi/email.cgi index 0d128b9..62c717d 100755 --- a/aux/cgi/email.cgi +++ b/aux/cgi/email.cgi @@ -4,6 +4,7 @@ use Digest::SHA qw/hmac_sha256_base64/; use Blerg::Database; use URI::Escape; use Mail::Message; +use JSON; use strict; use v5.10; @@ -141,6 +142,24 @@ EMAIL say '{"status": "success"}'; } + when ('status') { + my $username = validate_authentication($q); + if (!defined $username) { + print_403; + next REQUEST; + } + + my $email = undef; + my $email_conf_path = Blerg::Database::configuration->{data_path} . "/$username/email"; + if (-f $email_conf_path) { + open CONF, $email_conf_path; + $email = ; + close CONF; + } + + say header(-type => 'application/json'), + JSON->new->utf8->encode({email => $email}); + } when ('cancel') { my $username = validate_authentication($q); if (!defined $username) {