Exemple #1
0
    $user_id = @unpack('a32', @pack('H*', $user_id));
    if (is_array($user_id)) {
        $user_id = trim($user_id[1]);
        $user_key = substr($_COOKIE['dc_admin'], 0, 40);
        $user_pwd = null;
    } else {
        $user_id = null;
    }
}
# Recover password
if ($recover && !empty($_POST['user_id']) && !empty($_POST['user_email'])) {
    $user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null;
    $user_email = !empty($_POST['user_email']) ? $_POST['user_email'] : '';
    try {
        $recover_key = $core->auth->setRecoverKey($user_id, $user_email);
        $subject = mail::B64Header('DotClear ' . __('Password reset'));
        $message = __('Someone has requested to reset the password for the following site and username.') . "\n\n" . $page_url . "\n" . __('Username:'******' ' . $user_id . "\n\n" . __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\n" . $page_url . '?akey=' . $recover_key;
        $headers[] = 'From: ' . (defined('DC_ADMIN_MAILFROM') && DC_ADMIN_MAILFROM ? DC_ADMIN_MAILFROM : 'dotclear@local');
        $headers[] = 'Content-Type: text/plain; charset=UTF-8;';
        mail::sendMail($user_email, $subject, $message, $headers);
        $msg = sprintf(__('The e-mail was sent successfully to %s.'), $user_email);
    } catch (Exception $e) {
        $err = $e->getMessage();
    }
} elseif ($akey) {
    try {
        $recover_res = $core->auth->recoverUserPassword($akey);
        $subject = mb_encode_mimeheader('DotClear ' . __('Your new password'), 'UTF-8', 'B');
        $message = __('Username:'******' ' . $recover_res['user_id'] . "\n" . __('Password:'******' ' . $recover_res['new_pass'] . "\n\n" . preg_replace('/\\?(.*)$/', '', $page_url);
        $headers[] = 'From: dotclear@' . $_SERVER['HTTP_HOST'];
        $headers[] = 'Content-Type: text/plain; charset=UTF-8;';
Exemple #2
0
    $user_id = @unpack('a32', @pack('H*', $user_id));
    if (is_array($user_id)) {
        $user_id = $user_id[1];
        $user_key = substr($_COOKIE['bp_admin'], 0, 40);
        $user_pwd = null;
    } else {
        $user_id = null;
    }
}
# Recover password
if ($recover && !empty($_POST['user_id']) && !empty($_POST['user_email'])) {
    $user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null;
    $user_email = !empty($_POST['user_email']) ? $_POST['user_email'] : '';
    try {
        $recover_key = $core->auth->setRecoverKey($user_id, $user_email);
        $subject = mail::B64Header('Bilboplanet' . T_('Password reset'));
        $message = T_('Someone has requested to reset the password for the following site and username.') . "\n\n" . $page_url . "\n" . T_('User_id:') . ' ' . $user_id . "\n\n" . T_('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\n" . $page_url . '?akey=' . $recover_key;
        $headers[] = 'From: bilboplanet@' . $_SERVER['HTTP_HOST'];
        $headers[] = 'Content-Type: text/plain; charset=UTF-8;';
        mail::sendMail($user_email, $subject, $message, $headers);
        $msg = sprintf(T_('The e-mail was sent successfully to %s.'), $user_email);
    } catch (Exception $e) {
        $err = $e->getMessage();
    }
} elseif ($akey) {
    try {
        $recover_res = $core->auth->recoverUserPassword($akey);
        $subject = mb_encode_mimeheader('Bilboplanet ' . T_('Your new password'), 'UTF-8', 'B');
        $message = T_('Username:'******' ' . $recover_res['user_id'] . "\n" . T_('Password:'******' ' . $recover_res['new_pass'] . "\n\n" . preg_replace('/\\?(.*)$/', '', $page_url);
        $headers[] = 'From: bilboplanet@' . $_SERVER['HTTP_HOST'];
        $headers[] = 'Content-Type: text/plain; charset=UTF-8;';