Compare commits
1 commit
ce8f658270
...
806372deb9
Author | SHA1 | Date | |
---|---|---|---|
Sebastian Wagner | 806372deb9 |
|
@ -43,37 +43,32 @@ class Request extends BaseClass {
|
|||
|
||||
$ip = getRemoteHexIP();
|
||||
$this->log->i("Request started for nick: {$_POST['login']}");
|
||||
try {
|
||||
if (false === $this->checkCaptcha()) {
|
||||
$message = "Captcha invalid";
|
||||
return false;
|
||||
} else if (false === $this->checkEmail()) {
|
||||
$message = "Email invalid";
|
||||
return false;
|
||||
} else if (false === $this->checkMXID($this->config->getMxDomain())) {
|
||||
$message = "User ID invalid";
|
||||
return false;
|
||||
} else if (false === $this->checkUser($_POST['login'] ?? '')) {
|
||||
$message = "User Id is already taken";
|
||||
return false;
|
||||
} else if (false === $this->checkRequests($ip)) {
|
||||
$message = "Too many requests";
|
||||
return false;
|
||||
} else {
|
||||
if ($this->generateToken(16) === true) {
|
||||
if ($this->saveRequest($ip) === true) {
|
||||
if ($this->sendVerificationMail() === true) {
|
||||
$login = htmlspecialchars($_POST['login']);
|
||||
$message = "Your request for '{$login}' is saved and a
|
||||
verification mail is send";
|
||||
return true;
|
||||
}
|
||||
if (false === $this->checkCaptcha()) {
|
||||
$message = "Captcha invalid";
|
||||
return false;
|
||||
} else if (false === $this->checkEmail()) {
|
||||
$message = "Email invalid";
|
||||
return false;
|
||||
} else if (false === $this->checkMXID($this->config->getMxDomain())) {
|
||||
$message = "User ID invalid";
|
||||
return false;
|
||||
} else if (false === $this->checkUser($_POST['login'] ?? '')) {
|
||||
$message = "User Id is already taken";
|
||||
return false;
|
||||
} else if (false === $this->checkRequests($ip)) {
|
||||
$message = "Too many requests";
|
||||
return false;
|
||||
} else {
|
||||
if ($this->generateToken(16) === true) {
|
||||
if ($this->saveRequest($ip) === true) {
|
||||
if ($this->sendVerificationMail() === true) {
|
||||
$login = htmlspecialchars($_POST['login']);
|
||||
$message = "Your request for '{$login}' is saved and a
|
||||
verification mail is send";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
$this->log->e($e->getMessage());
|
||||
$message = "unexpected error";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue