fetchUserByEmail() 공개 정적인 메소드

public static fetchUserByEmail ( $email, $xmpp_username = false )
예제 #1
0
<?php

$cfgSite = erConfigClassLhConfig::getInstance();
$secretHash = $cfgSite->getSetting('site', 'secrethash');
if ($Params['user_parameters']['validation_hash'] == sha1(sha1($Params['user_parameters']['email'] . $secretHash) . $secretHash)) {
    $accept = erLhcoreClassModelChatAccept::fetchByHash($Params['user_parameters']['hash']);
    if ($accept !== false) {
        $chat_id = $accept->chat_id;
        if ($accept->wused == 0) {
            $userID = erLhcoreClassModelUser::fetchUserByEmail($Params['user_parameters']['email'], trim($Params['user_parameters']['email']) != '' ? trim($Params['user_parameters']['email']) : false);
            if ($userID !== false && $accept->ctime > time() - erLhcoreClassModelChatConfig::fetch('accept_chat_link_timeout')->current_value) {
                $accept->wused = 1;
                $accept->saveThis();
                erLhcoreClassUser::instance()->setLoggedUser($userID);
                erLhcoreClassModule::redirect('chat/single', '/' . $chat_id);
                exit;
            } else {
                erLhcoreClassModule::redirect('user/login', '/(r)/' . rawurlencode(base64_encode('chat/single/' . $chat_id)));
                exit;
            }
        } else {
            erLhcoreClassModule::redirect('user/login', '/(r)/' . rawurlencode(base64_encode('chat/single/' . $chat_id)));
            exit;
        }
        erLhcoreClassModelChatAccept::cleanup();
    }
}
erLhcoreClassModule::redirect('user/login');
exit;
예제 #2
0
$tpl = erLhcoreClassTemplate::getInstance('lhuser/forgotpassword.tpl.php');
$currentUser = erLhcoreClassUser::instance();
if (isset($_POST['Forgotpassword'])) {
    $definition = array('Email' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'validate_email'));
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('user/forgotpassword');
        exit;
    }
    if (!$form->hasValidData('Email')) {
        $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/forgotpassword', 'Invalid e-mail address!');
    }
    if (count($Errors) == 0) {
        if (($userID = erLhcoreClassModelUser::fetchUserByEmail($form->Email)) !== false) {
            $host = $_SERVER['HTTP_HOST'];
            $adminEmail = erConfigClassLhConfig::getInstance()->getSetting('site', 'site_admin_email');
            $UserData = erLhcoreClassUser::getSession()->load('erLhcoreClassModelUser', $userID);
            $hash = erLhcoreClassModelForgotPassword::randomPassword(40);
            erLhcoreClassModelForgotPassword::setRemindHash($UserData->id, $hash);
            $mail = new PHPMailer();
            $mail->CharSet = "UTF-8";
            $mail->From = $adminEmail;
            $mail->FromName = erConfigClassLhConfig::getInstance()->getSetting('site', 'title');
            $mail->Subject = erTranslationClassLhTranslation::getInstance()->getTranslation('user/forgotpassword', 'Password remind');
            // HTML body
            $body = erTranslationClassLhTranslation::getInstance()->getTranslation('user/forgotpassword', 'Click this link and You will be sent a new password') . ' </br><a href="http://' . $host . erLhcoreClassDesign::baseurl('user/remindpassword') . '/' . $hash . '">Restore password</a>';
            // Plain text body
            $text_body = erTranslationClassLhTranslation::getInstance()->getTranslation('user/forgotpassword', 'Click this link and You will be sent a new password') . ' - http://' . $host . erLhcoreClassDesign::baseurl('user/remindpassword') . '/' . $hash;
            $mail->Body = $body;