'; echo ''; echo '
'; echo ''; echo ''; echo 'Email confirmation'; echo "\n"; echo ' > Selector'; echo "\t\t\t\t"; echo \htmlspecialchars($selector); echo "\n"; echo ' > Token'; echo "\t\t\t\t"; echo \htmlspecialchars($token); echo ''; }; } else { $callback = null; } if (!isset($_POST['require_unique_username'])) { $_POST['require_unique_username'] = '0'; } if ($_POST['require_unique_username'] == 0) { return $auth->register($_POST['email'], $_POST['password'], $_POST['username'], $callback); } else { return $auth->registerWithUniqueUsername($_POST['email'], $_POST['password'], $_POST['username'], $callback); } } catch (\Delight\Auth\InvalidEmailException $e) { return 'invalid email address'; } catch (\Delight\Auth\InvalidPasswordException $e) { return 'invalid password'; } catch (\Delight\Auth\UserAlreadyExistsException $e) { return 'email address already exists'; } catch (\Delight\Auth\DuplicateUsernameException $e) { return 'username already exists'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'confirmEmail') { try { if (isset($_POST['login']) && $_POST['login'] > 0) { if ($_POST['login'] == 2) { // keep logged in for one year $rememberDuration = (int) (60 * 60 * 24 * 365.25); } else { // do not keep logged in after session ends $rememberDuration = null; } return $auth->confirmEmailAndSignIn($_POST['selector'], $_POST['token'], $rememberDuration); } else { return $auth->confirmEmail($_POST['selector'], $_POST['token']); } } catch (\Delight\Auth\InvalidSelectorTokenPairException $e) { return 'invalid token'; } catch (\Delight\Auth\TokenExpiredException $e) { return 'token expired'; } catch (\Delight\Auth\UserAlreadyExistsException $e) { return 'email address already exists'; } catch (\Delight\Auth\SecondFactorRequiredException $e) { $secondFactorOptions = []; if ($e->hasTotpOption()) { $secondFactorOptions[] = 'TOTP'; } if ($e->hasSmsOption()) { $secondFactorOptions[] = 'SMS (' . $e->getSmsRecipient() . ' / ' . $e->getSmsRecipientMasked() . ') with ' . $e->getSmsOtpValue(); } if ($e->hasEmailOption()) { $secondFactorOptions[] = 'email (' . $e->getEmailRecipient() . ' / ' . $e->getEmailRecipientMasked() . ') with ' . $e->getEmailOtpValue(); } return 'second factor required: ' . \implode(' / ', $secondFactorOptions); } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'resendConfirmationForEmail') { try { $auth->resendConfirmationForEmail($_POST['email'], function ($selector, $token) { echo '
'; echo 'Email confirmation'; echo "\n"; echo ' > Selector'; echo "\t\t\t\t"; echo \htmlspecialchars($selector); echo "\n"; echo ' > Token'; echo "\t\t\t\t"; echo \htmlspecialchars($token); echo ''; }); return 'ok'; } catch (\Delight\Auth\ConfirmationRequestNotFound $e) { return 'no request found'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'resendConfirmationForUserId') { try { $auth->resendConfirmationForUserId($_POST['userId'], function ($selector, $token) { echo '
'; echo 'Email confirmation'; echo "\n"; echo ' > Selector'; echo "\t\t\t\t"; echo \htmlspecialchars($selector); echo "\n"; echo ' > Token'; echo "\t\t\t\t"; echo \htmlspecialchars($token); echo ''; }); return 'ok'; } catch (\Delight\Auth\ConfirmationRequestNotFound $e) { return 'no request found'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'forgotPassword') { try { $auth->forgotPassword($_POST['email'], function ($selector, $token) { echo '
'; echo 'Password reset'; echo "\n"; echo ' > Selector'; echo "\t\t\t\t"; echo \htmlspecialchars($selector); echo "\n"; echo ' > Token'; echo "\t\t\t\t"; echo \htmlspecialchars($token); echo ''; }); return 'ok'; } catch (\Delight\Auth\InvalidEmailException $e) { return 'invalid email address'; } catch (\Delight\Auth\EmailNotVerifiedException $e) { return 'email address not verified'; } catch (\Delight\Auth\ResetDisabledException $e) { return 'password reset is disabled'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'resetPassword') { try { if (isset($_POST['login']) && $_POST['login'] > 0) { if ($_POST['login'] == 2) { // keep logged in for one year $rememberDuration = (int) (60 * 60 * 24 * 365.25); } else { // do not keep logged in after session ends $rememberDuration = null; } return $auth->resetPasswordAndSignIn($_POST['selector'], $_POST['token'], $_POST['password'], $rememberDuration); } else { return $auth->resetPassword($_POST['selector'], $_POST['token'], $_POST['password']); } } catch (\Delight\Auth\InvalidSelectorTokenPairException $e) { return 'invalid token'; } catch (\Delight\Auth\TokenExpiredException $e) { return 'token expired'; } catch (\Delight\Auth\ResetDisabledException $e) { return 'password reset is disabled'; } catch (\Delight\Auth\InvalidPasswordException $e) { return 'invalid password'; } catch (\Delight\Auth\SecondFactorRequiredException $e) { $secondFactorOptions = []; if ($e->hasTotpOption()) { $secondFactorOptions[] = 'TOTP'; } if ($e->hasSmsOption()) { $secondFactorOptions[] = 'SMS (' . $e->getSmsRecipient() . ' / ' . $e->getSmsRecipientMasked() . ') with ' . $e->getSmsOtpValue(); } if ($e->hasEmailOption()) { $secondFactorOptions[] = 'email (' . $e->getEmailRecipient() . ' / ' . $e->getEmailRecipientMasked() . ') with ' . $e->getEmailOtpValue(); } return 'second factor required: ' . \implode(' / ', $secondFactorOptions); } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'canResetPassword') { try { $auth->canResetPasswordOrThrow($_POST['selector'], $_POST['token']); return 'yes'; } catch (\Delight\Auth\InvalidSelectorTokenPairException $e) { return 'invalid token'; } catch (\Delight\Auth\TokenExpiredException $e) { return 'token expired'; } catch (\Delight\Auth\ResetDisabledException $e) { return 'password reset is disabled'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'prepareTwoFactorViaTotp') { try { $keyUriAndSecret = $auth->prepareTwoFactorViaTotp($_POST['serviceName']); return \implode(' | ', $keyUriAndSecret); } catch (\Delight\Auth\TwoFactorMechanismAlreadyEnabledException $e) { return 'already enabled'; } catch (\Delight\Auth\NotLoggedInException $e) { return 'not logged in'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'prepareTwoFactorViaSms') { try { $phoneNumberAndOtpValue = $auth->prepareTwoFactorViaSms($_POST['phoneNumber']); return $phoneNumberAndOtpValue[1] . ' -> ' . $phoneNumberAndOtpValue[0]; } catch (\Delight\Auth\InvalidPhoneNumberException $e) { return 'invalid phone number'; } catch (\Delight\Auth\TwoFactorMechanismAlreadyEnabledException $e) { return 'already enabled'; } catch (\Delight\Auth\NotLoggedInException $e) { return 'not logged in'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'prepareTwoFactorViaEmail') { try { $emailAddressAndOtpValue = $auth->prepareTwoFactorViaEmail(); return $emailAddressAndOtpValue[1] . ' -> ' . $emailAddressAndOtpValue[0]; } catch (\Delight\Auth\TwoFactorMechanismAlreadyEnabledException $e) { return 'already enabled'; } catch (\Delight\Auth\NotLoggedInException $e) { return 'not logged in'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'enableTwoFactorViaTotp') { try { $recoveryCodes = $auth->enableTwoFactorViaTotp($_POST['otpValue']); return \implode(' | ', $recoveryCodes); } catch (\Delight\Auth\InvalidOneTimePasswordException $e) { return 'invalid OTP'; } catch (\Delight\Auth\TwoFactorMechanismNotInitializedException $e) { return 'not initialized'; } catch (\Delight\Auth\TwoFactorMechanismAlreadyEnabledException $e) { return 'already enabled'; } catch (\Delight\Auth\NotLoggedInException $e) { return 'not logged in'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'enableTwoFactorViaSms') { try { $recoveryCodes = $auth->enableTwoFactorViaSms($_POST['otpValue']); return \implode(' | ', $recoveryCodes); } catch (\Delight\Auth\InvalidOneTimePasswordException $e) { return 'invalid OTP'; } catch (\Delight\Auth\TwoFactorMechanismNotInitializedException $e) { return 'not initialized'; } catch (\Delight\Auth\TwoFactorMechanismAlreadyEnabledException $e) { return 'already enabled'; } catch (\Delight\Auth\NotLoggedInException $e) { return 'not logged in'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'enableTwoFactorViaEmail') { try { $recoveryCodes = $auth->enableTwoFactorViaEmail($_POST['otpValue']); return \implode(' | ', $recoveryCodes); } catch (\Delight\Auth\InvalidOneTimePasswordException $e) { return 'invalid OTP'; } catch (\Delight\Auth\TwoFactorMechanismNotInitializedException $e) { return 'not initialized'; } catch (\Delight\Auth\TwoFactorMechanismAlreadyEnabledException $e) { return 'already enabled'; } catch (\Delight\Auth\NotLoggedInException $e) { return 'not logged in'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'disableTwoFactorViaTotp') { try { $auth->disableTwoFactorViaTotp(); return 'ok'; } catch (\Delight\Auth\NotLoggedInException $e) { return 'not logged in'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'disableTwoFactorViaSms') { try { $auth->disableTwoFactorViaSms(); return 'ok'; } catch (\Delight\Auth\NotLoggedInException $e) { return 'not logged in'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'disableTwoFactorViaEmail') { try { $auth->disableTwoFactorViaEmail(); return 'ok'; } catch (\Delight\Auth\NotLoggedInException $e) { return 'not logged in'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'disableTwoFactor') { try { $auth->disableTwoFactor(); return 'ok'; } catch (\Delight\Auth\NotLoggedInException $e) { return 'not logged in'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'reconfirmPassword') { try { return $auth->reconfirmPassword($_POST['password']) ? 'correct' : 'wrong'; } catch (\Delight\Auth\NotLoggedInException $e) { return 'not logged in'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'changePassword') { try { $auth->changePassword($_POST['oldPassword'], $_POST['newPassword']); return 'ok'; } catch (\Delight\Auth\NotLoggedInException $e) { return 'not logged in'; } catch (\Delight\Auth\InvalidPasswordException $e) { return 'invalid password(s)'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'changePasswordWithoutOldPassword') { try { $auth->changePasswordWithoutOldPassword($_POST['newPassword']); return 'ok'; } catch (\Delight\Auth\NotLoggedInException $e) { return 'not logged in'; } catch (\Delight\Auth\InvalidPasswordException $e) { return 'invalid password'; } } else if ($_POST['action'] === 'changeEmail') { try { $auth->changeEmail($_POST['newEmail'], function ($selector, $token) { echo '
'; echo 'Email confirmation'; echo "\n"; echo ' > Selector'; echo "\t\t\t\t"; echo \htmlspecialchars($selector); echo "\n"; echo ' > Token'; echo "\t\t\t\t"; echo \htmlspecialchars($token); echo ''; }); return 'ok'; } catch (\Delight\Auth\InvalidEmailException $e) { return 'invalid email address'; } catch (\Delight\Auth\UserAlreadyExistsException $e) { return 'email address already exists'; } catch (\Delight\Auth\EmailNotVerifiedException $e) { return 'account not verified'; } catch (\Delight\Auth\NotLoggedInException $e) { return 'not logged in'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'changeUsername') { try { $auth->changeUsername($_POST['newUsername'], $_POST['requireUnique']); return 'ok'; } catch (\Delight\Auth\DuplicateUsernameException $e) { return 'username already exists'; } catch (\Delight\Auth\NotLoggedInException $e) { return 'not logged in'; } catch (\Delight\Auth\TooManyRequestsException $e) { return 'too many requests'; } } else if ($_POST['action'] === 'setPasswordResetEnabled') { try { $auth->setPasswordResetEnabled($_POST['enabled'] == 1); return 'ok'; } catch (\Delight\Auth\NotLoggedInException $e) { return 'not logged in'; } } else if ($_POST['action'] === 'logOut') { $auth->logOut(); return 'ok'; } else if ($_POST['action'] === 'logOutEverywhereElse') { try { $auth->logOutEverywhereElse(); } catch (\Delight\Auth\NotLoggedInException $e) { return 'not logged in'; } return 'ok'; } else if ($_POST['action'] === 'logOutEverywhere') { try { $auth->logOutEverywhere(); } catch (\Delight\Auth\NotLoggedInException $e) { return 'not logged in'; } return 'ok'; } else if ($_POST['action'] === 'destroySession') { $auth->destroySession(); return 'ok'; } else if ($_POST['action'] === 'admin.createUser') { try { if (!isset($_POST['require_unique_username'])) { $_POST['require_unique_username'] = '0'; } if ($_POST['require_unique_username'] == 0) { return $auth->admin()->createUser($_POST['email'], $_POST['password'], $_POST['username']); } else { return $auth->admin()->createUserWithUniqueUsername($_POST['email'], $_POST['password'], $_POST['username']); } } catch (\Delight\Auth\InvalidEmailException $e) { return 'invalid email address'; } catch (\Delight\Auth\InvalidPasswordException $e) { return 'invalid password'; } catch (\Delight\Auth\UserAlreadyExistsException $e) { return 'email address already exists'; } catch (\Delight\Auth\DuplicateUsernameException $e) { return 'username already exists'; } } else if ($_POST['action'] === 'admin.deleteUser') { if (isset($_POST['id'])) { try { $auth->admin()->deleteUserById($_POST['id']); } catch (\Delight\Auth\UnknownIdException $e) { return 'unknown ID'; } } elseif (isset($_POST['email'])) { try { $auth->admin()->deleteUserByEmail($_POST['email']); } catch (\Delight\Auth\InvalidEmailException $e) { return 'unknown email address'; } } elseif (isset($_POST['username'])) { try { $auth->admin()->deleteUserByUsername($_POST['username']); } catch (\Delight\Auth\UnknownUsernameException $e) { return 'unknown username'; } catch (\Delight\Auth\AmbiguousUsernameException $e) { return 'ambiguous username'; } } else { return 'either ID, email address or username required'; } return 'ok'; } else if ($_POST['action'] === 'admin.addRole') { if (isset($_POST['role'])) { if (isset($_POST['id'])) { try { $auth->admin()->addRoleForUserById($_POST['id'], $_POST['role']); } catch (\Delight\Auth\UnknownIdException $e) { return 'unknown ID'; } } elseif (isset($_POST['email'])) { try { $auth->admin()->addRoleForUserByEmail($_POST['email'], $_POST['role']); } catch (\Delight\Auth\InvalidEmailException $e) { return 'unknown email address'; } } elseif (isset($_POST['username'])) { try { $auth->admin()->addRoleForUserByUsername($_POST['username'], $_POST['role']); } catch (\Delight\Auth\UnknownUsernameException $e) { return 'unknown username'; } catch (\Delight\Auth\AmbiguousUsernameException $e) { return 'ambiguous username'; } } else { return 'either ID, email address or username required'; } } else { return 'role required'; } return 'ok'; } else if ($_POST['action'] === 'admin.removeRole') { if (isset($_POST['role'])) { if (isset($_POST['id'])) { try { $auth->admin()->removeRoleForUserById($_POST['id'], $_POST['role']); } catch (\Delight\Auth\UnknownIdException $e) { return 'unknown ID'; } } elseif (isset($_POST['email'])) { try { $auth->admin()->removeRoleForUserByEmail($_POST['email'], $_POST['role']); } catch (\Delight\Auth\InvalidEmailException $e) { return 'unknown email address'; } } elseif (isset($_POST['username'])) { try { $auth->admin()->removeRoleForUserByUsername($_POST['username'], $_POST['role']); } catch (\Delight\Auth\UnknownUsernameException $e) { return 'unknown username'; } catch (\Delight\Auth\AmbiguousUsernameException $e) { return 'ambiguous username'; } } else { return 'either ID, email address or username required'; } } else { return 'role required'; } return 'ok'; } else if ($_POST['action'] === 'admin.hasRole') { if (isset($_POST['id'])) { if (isset($_POST['role'])) { try { return $auth->admin()->doesUserHaveRole($_POST['id'], $_POST['role']) ? 'yes' : 'no'; } catch (\Delight\Auth\UnknownIdException $e) { return 'unknown ID'; } } else { return 'role required'; } } else { return 'ID required'; } } else if ($_POST['action'] === 'admin.getRoles') { if (isset($_POST['id'])) { try { return $auth->admin()->getRolesForUserById($_POST['id']); } catch (\Delight\Auth\UnknownIdException $e) { return 'unknown ID'; } } else { return 'ID required'; } } else if ($_POST['action'] === 'admin.logInAsUserById') { if (isset($_POST['id'])) { try { $auth->admin()->logInAsUserById($_POST['id']); return 'ok'; } catch (\Delight\Auth\UnknownIdException $e) { return 'unknown ID'; } catch (\Delight\Auth\EmailNotVerifiedException $e) { return 'email address not verified'; } } else { return 'ID required'; } } else if ($_POST['action'] === 'admin.logInAsUserByEmail') { if (isset($_POST['email'])) { try { $auth->admin()->logInAsUserByEmail($_POST['email']); return 'ok'; } catch (\Delight\Auth\InvalidEmailException $e) { return 'unknown email address'; } catch (\Delight\Auth\EmailNotVerifiedException $e) { return 'email address not verified'; } } else { return 'Email address required'; } } else if ($_POST['action'] === 'admin.logInAsUserByUsername') { if (isset($_POST['username'])) { try { $auth->admin()->logInAsUserByUsername($_POST['username']); return 'ok'; } catch (\Delight\Auth\UnknownUsernameException $e) { return 'unknown username'; } catch (\Delight\Auth\AmbiguousUsernameException $e) { return 'ambiguous username'; } catch (\Delight\Auth\EmailNotVerifiedException $e) { return 'email address not verified'; } } else { return 'Username required'; } } else if ($_POST['action'] === 'admin.changePasswordForUser') { if (isset($_POST['newPassword'])) { if (isset($_POST['id'])) { try { $auth->admin()->changePasswordForUserById($_POST['id'], $_POST['newPassword']); } catch (\Delight\Auth\UnknownIdException $e) { return 'unknown ID'; } catch (\Delight\Auth\InvalidPasswordException $e) { return 'invalid password'; } } elseif (isset($_POST['username'])) { try { $auth->admin()->changePasswordForUserByUsername($_POST['username'], $_POST['newPassword']); } catch (\Delight\Auth\UnknownUsernameException $e) { return 'unknown username'; } catch (\Delight\Auth\AmbiguousUsernameException $e) { return 'ambiguous username'; } catch (\Delight\Auth\InvalidPasswordException $e) { return 'invalid password'; } } else { return 'either ID or username required'; } } else { return 'new password required'; } return 'ok'; } else { throw new Exception('Unexpected action: ' . $_POST['action']); } } } return null; } function showDebugData(\Delight\Auth\Auth $auth, $result) { echo '
'; echo 'Last operation' . "\t\t\t\t"; \var_dump($result); echo 'Session ID' . "\t\t\t\t"; \var_dump(\session_id()); echo "\n"; echo '$auth->isLoggedIn()' . "\t\t\t"; \var_dump($auth->isLoggedIn()); echo '$auth->check()' . "\t\t\t\t"; \var_dump($auth->check()); echo "\n"; echo '$auth->getUserId()' . "\t\t\t"; \var_dump($auth->getUserId()); echo '$auth->id()' . "\t\t\t\t"; \var_dump($auth->id()); echo "\n"; echo '$auth->getEmail()' . "\t\t\t"; \var_dump($auth->getEmail()); echo '$auth->getUsername()' . "\t\t\t"; \var_dump($auth->getUsername()); echo '$auth->getStatus()' . "\t\t\t"; echo \convertStatusToText($auth); echo ' / '; \var_dump($auth->getStatus()); echo "\n"; echo 'Roles (super moderator)' . "\t\t\t"; \var_dump($auth->hasRole(\Delight\Auth\Role::SUPER_MODERATOR)); echo 'Roles (developer *or* manager)' . "\t\t"; \var_dump($auth->hasAnyRole(\Delight\Auth\Role::DEVELOPER, \Delight\Auth\Role::MANAGER)); echo 'Roles (developer *and* manager)' . "\t\t"; \var_dump($auth->hasAllRoles(\Delight\Auth\Role::DEVELOPER, \Delight\Auth\Role::MANAGER)); echo 'Roles' . "\t\t\t\t\t"; echo \json_encode($auth->getRoles()) . "\n"; echo "\n"; echo '$auth->isRemembered()' . "\t\t\t"; \var_dump($auth->isRemembered()); echo '$auth->getIpAddress()' . "\t\t\t"; \var_dump($auth->getIpAddress()); echo '$auth->hasTwoFactor()' . "\t\t\t"; \var_dump($auth->hasTwoFactor()); echo '$auth->hasTwoFactorViaTotp()' . "\t\t"; \var_dump($auth->hasTwoFactorViaTotp()); echo '$auth->hasTwoFactorViaSms()' . "\t\t"; \var_dump($auth->hasTwoFactorViaSms()); echo '$auth->hasTwoFactorViaEmail()' . "\t\t"; \var_dump($auth->hasTwoFactorViaEmail()); echo 'Waiting for 2FA' . "\t\t\t\t"; if ($auth->isWaitingForSecondFactor()) { echo 'User #' . ((int) $_SESSION[\Delight\Auth\Auth::SESSION_FIELD_AWAITING_2FA_USER_ID]) . ' (' . ($_SESSION[\Delight\Auth\Auth::SESSION_FIELD_AWAITING_2FA_UNTIL] - \time()) . ' seconds)'; } else { echo 'No'; } echo "\n\n"; echo 'Session name' . "\t\t\t\t"; \var_dump(\session_name()); echo 'Auth::createRememberCookieName()' . "\t"; \var_dump(\Delight\Auth\Auth::createRememberCookieName()); echo "\n"; echo 'Auth::createCookieName(\'session\')' . "\t"; \var_dump(\Delight\Auth\Auth::createCookieName('session')); echo 'Auth::createRandomString()' . "\t\t"; \var_dump(\Delight\Auth\Auth::createRandomString()); echo 'Auth::createUuid()' . "\t\t\t"; \var_dump(\Delight\Auth\Auth::createUuid()); echo ''; } function convertStatusToText(\Delight\Auth\Auth $auth) { if ($auth->isLoggedIn() === true) { if ($auth->getStatus() === \Delight\Auth\Status::NORMAL && $auth->isNormal()) { return 'normal'; } elseif ($auth->getStatus() === \Delight\Auth\Status::ARCHIVED && $auth->isArchived()) { return 'archived'; } elseif ($auth->getStatus() === \Delight\Auth\Status::BANNED && $auth->isBanned()) { return 'banned'; } elseif ($auth->getStatus() === \Delight\Auth\Status::LOCKED && $auth->isLocked()) { return 'locked'; } elseif ($auth->getStatus() === \Delight\Auth\Status::PENDING_REVIEW && $auth->isPendingReview()) { return 'pending review'; } elseif ($auth->getStatus() === \Delight\Auth\Status::SUSPENDED && $auth->isSuspended()) { return 'suspended'; } } elseif ($auth->isLoggedIn() === false) { if ($auth->getStatus() === null) { return 'none'; } } throw new Exception('Invalid status `' . $auth->getStatus() . '`'); } function showGeneralForm() { echo ''; } function showAuthenticatedUserForm(\Delight\Auth\Auth $auth) { echo ''; echo ''; echo ''; echo ''; echo ''; \showConfirmEmailForm(); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; \showDestroySessionForm(); } function showGuestUserForm() { echo '