]> ruin.nu Git - ndwebbie.git/commitdiff
Possible to clear email address
authorMichael Andreen <harv@ruin.nu>
Sat, 6 Oct 2018 07:46:58 +0000 (09:46 +0200)
committerMichael Andreen <harv@ruin.nu>
Sat, 6 Oct 2018 07:46:58 +0000 (09:46 +0200)
lib/NDWeb/Controller/Settings.pm

index 717b9095bb88991db31ef996d2cc79b86587421b..f95a97922373f9853649ad4f3091fb1b117f97d4 100644 (file)
@@ -132,6 +132,16 @@ sub changeEmail : Local {
 
        my $email = $c->req->param('email');
 
+       if ($email =~ /^s?$/) {
+               my $update = $dbh->prepare(q{
+UPDATE users SET email = NULL WHERE uid = $1;
+                       });
+               $update->execute($c->user->id);
+               $c->flash(error => 'email cleared');
+               $c->res->redirect($c->uri_for(''));
+               return,
+       }
+
        unless (Email::Valid->address($email)){
                $c->flash(email => $email);
                $c->flash(error => 'Invalid email address');