Exemplo n.º 1
0
    if (!$username) {
        throw new Exception('Username missing from password reset request.');
    }
    $person = new PSUPerson($username);
    if (!$reason && ($ssn != substr($person->ssn, -4) || $dob != $person->birth_date)) {
        $GLOBALS['LOG']->write('Password Reset Attempt Failed: invalid DOB & SSN portion provided.', $username);
        throw new Exception('The identity verification failed.  Either the last 4 of the SSN OR the Date of Birth did not match.');
    }
    //end if
    if ($reason && !IDMObject::authZ('permission', 'ape_pw')) {
        throw new Exception('You are not allowed to perform password resets without the last 4 of the SSN and Birth Date.');
    }
    //end if
    if (!$reason) {
        $reason = 'Private Data Provided and Verified';
    }
    //end if
    list($username, $password) = $GLOBALS['PWMAN']->defaultCredentials($username);
    $GLOBALS['PWMAN']->setPassword($username, $password);
    $GLOBALS['PWMAN']->expire($username, 'reset');
    $GLOBALS['LOG']->write('Resetting password: '******'Password Reset', 'Reset password.', array('call_status' => 'closed'))) {
        $message .= ' Ticket #<a href="http://go.plymouth.edu/log/' . $call_id . '">' . $call_id . '</a> has been logged.';
    }
    //end if
    $_SESSION['messages'][] = $message;
} catch (Exception $e) {
    $_SESSION['errors'][] = sprintf("%s (%d)", $e->GetMessage(), $e->GetCode());
}
PSUHTML::redirect($GLOBALS['BASE_URL'] . '/user/' . $username);
Exemplo n.º 2
0
        $_SESSION['messages'][] = $message;
        $keys = array('added', 'sourced_id', 'password', 'pidm', 'login_name', 'fullname', 'reason', 'locker_pidm');
        $values = array('NOW()', '?', '?', '?', '?', '?', '?', '?');
        $args = array($person->sourced_id, ' ', $pidm, $person->login_name, $person->formatName('f l'), $reason, $_SESSION['pidm']);
        $sql = "\n\t\t  INSERT INTO ape_support_locks (" . implode(', ', $keys) . ")\n\t\t  VALUES (" . implode(', ', $values) . ")\n\t\t";
        if (!PSU::db('myplymouth')->Execute($sql, $args)) {
            throw new Exception(PSU::db('myplymouth')->errorMsg());
        }
        $person->lock_wp_account();
    } else {
        $GLOBALS['LOG']->write('Unlocking account', $person->login_name);
        $message = "Account for {$person->login_name} has been unlocked.";
        if ($call = APE::find_ticket_by_source($person->wp_id ? $person->wp_id : $person->login_name, 'Account Locked')) {
            $call_id = $call['call_id'];
            $reason = $_GET['reason'] . "\n\n" . 'Account is now unlocked. (auto-updated via APE)';
            if (APE::update_ticket($call_id, $reason)) {
                $message .= ' Ticket #<a href="http://go.plymouth.edu/log/' . $call_id . '">' . $call_id . '</a> has been updated. It has <strong>not</strong> been closed.';
            }
            //end if
        }
        //end if
        $_SESSION['messages'][] = $message;
        $args = array();
        $sql = "DELETE FROM ape_support_locks WHERE pidm = ?";
        $args[] = $person->pidm;
        PSU::db('myplymouth')->Execute($sql, $args);
        $person->unlock_wp_account();
    }
} catch (Exception $e) {
    $_SESSION['errors'][] = sprintf("%s (%d)", $e->GetMessage(), $e->GetCode());
}