Phpauth\Auth::activate PHP Method

activate() public method

Activates a user's account
public activate ( string $key ) : array
$key string
return array $return
    public function activate($key)
    {
        $return['error'] = true;
        $block_status = $this->isBlocked();
        if ($block_status == "block") {
            $return['message'] = $this->lang["user_blocked"];
            return $return;
        }
        if (strlen($key) !== 20) {
            $this->addAttempt();
            $return['message'] = $this->lang["activationkey_invalid"];
            return $return;
        }
        $getRequest = $this->getRequest($key, "activation");
        if ($getRequest['error'] == 1) {
            $return['message'] = $getRequest['message'];
            return $return;
        }
        if ($this->getBaseUser($getRequest['uid'])['isactive'] == 1) {
            $this->addAttempt();
            $this->deleteRequest($getRequest['id']);
            $return['message'] = $this->lang["system_error"] . " #02";
            return $return;
        }
        $query = $this->dbh->prepare("UPDATE {$this->config->table_users} SET isactive = ? WHERE id = ?");
        $query->execute(array(1, $getRequest['uid']));
        $this->deleteRequest($getRequest['id']);
        $return['error'] = false;
        $return['message'] = $this->lang["account_activated"];
        return $return;
    }