Add email status to backend
use Blerg::Database;
use URI::Escape;
use Mail::Message;
+use JSON;
use strict;
use v5.10;
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 = <CONF>;
+ close CONF;
+ }
+
+ say header(-type => 'application/json'),
+ JSON->new->utf8->encode({email => $email});
+ }
when ('cancel') {
my $username = validate_authentication($q);
if (!defined $username) {