Esempio n. 1
0
/**
* Send activation mail to a person @ingroup pages
*/
function personSendActivation()
{
    global $PH;
    ### get person ####
    $person_id = getOnePassedId('person', 'people_*');
    if (!($person = Person::getEditableById($person_id))) {
        $PH->abortWarning(__("Insufficient rights"));
        exit;
    }
    if (!$person->office_email && !$person->personal_email) {
        $PH->abortWarning(__("Sending notifactions requires an email-address."));
        exit;
    }
    if (!($person->user_rights & RIGHT_PERSON_EDIT_SELF)) {
        $PH->abortWarning(__("Since the user does not have the right to edit his own profile and therefore to adjust his password, sending an activation does not make sense."), ERROR_NOTE);
        exit;
    }
    if (!$person->can_login) {
        $PH->abortWarning(__("Sending an activation mail does not make sense, until the user is allowed to login. Please adjust his profile."), ERROR_NOTE);
        exit;
    }
    $person->settings |= USER_SETTING_NOTIFICATIONS;
    $person->settings |= USER_SETTING_SEND_ACTIVATION;
    require_once confGet('DIR_STREBER') . 'std/class_email_password_reminder.inc.php';
    $email = new EmailPasswordReminder($person);
    if ($email->send()) {
        new FeedbackMessage(__("Activation mail has been sent."));
    }
    ### display taskView ####
    if (!$PH->showFromPage()) {
        $PH->show('projView', array('prj' => $person->project));
    }
}
Esempio n. 2
0
/**
* submit Forgot password data @ingroup pages
*/
function loginForgotPasswordSubmit()
{
    global $PH;
    global $auth;
    ### cancel? ###
    if (get('form_do_cancel')) {
        if (!$PH->showFromPage()) {
            $PH->show('loginForm');
        }
        exit;
    }
    if (!($name = get('login_name'))) {
        $PH->messages[] = __('If you remember your name, please enter it and try again.');
        $PH->show('loginForgotPassword');
        exit;
    } else {
        if ($person = Person::getByNickname(get('login_name'))) {
            if ($person->can_login) {
                if ($person->office_email || $person->personal_email) {
                    require_once confGet('DIR_STREBER') . 'std/class_email_password_reminder.inc.php';
                    $email = new EmailPasswordReminder($person);
                    $email->send();
                    $person->settings |= USER_SETTING_NOTIFICATIONS;
                    $person->settings |= USER_SETTING_SEND_ACTIVATION;
                }
            }
        }
        $PH->messages[] = __('A notification mail has been sent.');
        $PH->show('loginForm');
        exit;
    }
}