user_activation.php 522 B

1234567891011121314151617
  1. <?php
  2. $user = User::queryOne([
  3. "verify_token" => $token
  4. ]);
  5. if($user && $user->activated == 0) {
  6. $user->activated = 1;
  7. $success = $user->commit();
  8. if(!$success) throw new Exception("Email verification failed. Please try again later.");
  9. Core::addAlert("success", "Email address verified. You can now log in to your account.");
  10. }
  11. else {
  12. Core::addAlert("danger", "Invalid verification token. The user account may have already been activated or the token has expired. Please try again.");
  13. }
  14. HTTP::redirect("/log-in");