Your verificaton link is valid. Good job!', 'success') : null ?>
Redirecting in 5 seconds...', 'danger') ?>
'; ?> getVerification(\Models\Verification::TYPE_PHONE); } try { switch ($action) { case 'deliver': if (is_post()) { \App\Content::verifyPost(); // $phone = $_user->phone; $phone = phone(get('phone', $_POST)); // formatted $verification = $_user->createVerification(\Models\Verification::TYPE_PHONE, $phone, \Models\Verification::METHOD_SMS); try { $delivered = $verification->deliver(); if ($delivered) { // redirect i.e. refresh the page redirect(APP_URL.'/php_security_phone_verify.php'); } else { throw new Exception('Failed to deliver the code! Note that demo site is not setup with Twilio.'); } } catch (Exception $ex) { $verification = null; throw $ex; } } break; case 'reset': // delete the old verification if ($verification) { $verification->delete(); $verification = null; } break; case 'validate': if (is_post()) { \App\Content::verifyPost(); $code = get('code'); // in production, the following code instead // $_user->verifyPhone($code); if ($code && $verification && $verification->validate($_user)) { $verified = $verification->verify($code); if ($verified) { // redirect to somewhere for a successful verification redirect(APP_URL.'/php_security_phone_verify.php?verified=1'); } else { throw new Exception('Invalid verification link'); } } else { throw new Exception('Invalid verification link'); } } break; } } catch (Exception $ex) { $exception = $ex->getMessage(); $defaults = $_POST; } ?>