auth: create user object regardless of login
[minimedit.git] / widget / contact.php
index ed0a0828140c7f875a7271d98075b31155b678a3..b7e073fe40f72890260fcab2f448fd6ca1f3123a 100644 (file)
@@ -2,7 +2,7 @@
 $error = NULL;
 if ($_POST) {
        global $User;
-       if ($User) {
+       if ($User->login) {
                $_REQUEST['login'] = $User->login;
                $_REQUEST['email'] = $_REQUEST['email'] ?: $User->email;
        }
@@ -50,7 +50,7 @@ switch ($source) {
        }
 }
 
-       $reply = preg_match('/\A\w+@\w+\.[a-z]+\z/', @$input['email'])
+       $reply = preg_match('/\A[^\s\'@]{1,64}@[.a-zA-Z0-9-]{4,63}\z/', @$input['email'])
                ? $input['email'] : "noreply@$domain";
        $header = "From: $reply";