Example #1
0
     require_once 'views/confirm-request.php';
 } else {
     if ($_GET['page'] === 'activate-user') {
         $success = $pro->activateUserAccount($_POST);
         if ($success === 1) {
             $loggers['audit']->info("User activated (username: {$_POST['user_name']})");
             echo 'success';
         } else {
             $loggers['audit']->notice("Failed to activate user (username: {$_POST['user_name']})");
             echo 'failure';
         }
     } else {
         if ($_GET['page'] === 'reset_pass') {
             if (isset($_POST['new'])) {
                 header('Content-Type: text/plain');
                 echo $pro->updatePassword($_POST['username'], $_POST['new']);
                 $loggers['audit']->info("Password reset completed for user {$_POST['username']}");
                 exit;
             }
             if (isset($_POST['user_name'])) {
                 $mail = $pro->generatePasswordResetLink($_POST['user_name']);
                 if ($mail) {
                     $loggers['audit']->info("Initiated password reset for user {$_POST['user_name']}");
                     echo 'success';
                 } else {
                     $loggers['audit']->notice("Failed to initiate password reset for user {$_POST['user_name']}");
                     echo 'query failed or link not mailed';
                 }
             } else {
                 echo 'no user name';
             }