Browse Source

Setup e-mail fix

master
Egorka 6 years ago
parent
commit
5efae5c9af
  1. 6
      setup.php

6
setup.php

@ -204,12 +204,12 @@ class Setup
while (!$this->_username = readline($this->l('Username: '))) { while (!$this->_username = readline($this->l('Username: '))) {
echo Console::log($this->l('Username must be set'), 'red') . PHP_EOL; echo Console::log($this->l('Username must be set'), 'red') . PHP_EOL;
}; };
while (!$this->_email || ($this->_email && $this->checkEmail($this->_email))) { while (!$this->_email || ($this->_email && !$this->trueEmail($this->_email))) {
$this->_email = readline('E-mail: '); $this->_email = readline('E-mail: ');
if (!$this->_email) { if (!$this->_email) {
echo Console::log($this->l('E-mail must be set'), 'red') . PHP_EOL; echo Console::log($this->l('E-mail must be set'), 'red') . PHP_EOL;
} }
if (!$this->checkEmail($this->_email)) { if (!$this->trueEmail($this->_email)) {
echo Console::log($this->l('E-mail must be correct'), 'red') . PHP_EOL; echo Console::log($this->l('E-mail must be correct'), 'red') . PHP_EOL;
} }
} }
@ -227,7 +227,7 @@ class Setup
echo Console::log($this->l('Admin account complete'), 'green') . PHP_EOL; echo Console::log($this->l('Admin account complete'), 'green') . PHP_EOL;
} }
private function checkEmail($email): bool private function trueEmail($email): bool
{ {
$email = filter_var($email, FILTER_VALIDATE_EMAIL); $email = filter_var($email, FILTER_VALIDATE_EMAIL);
return $email ? true : false; return $email ? true : false;

Loading…
Cancel
Save