当前位置: 首页>>代码示例>>PHP>>正文


PHP Validate::isPasswd方法代码示例

本文整理汇总了PHP中Validate::isPasswd方法的典型用法代码示例。如果您正苦于以下问题:PHP Validate::isPasswd方法的具体用法?PHP Validate::isPasswd怎么用?PHP Validate::isPasswd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Validate的用法示例。


在下文中一共展示了Validate::isPasswd方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postProcess

 public function postProcess()
 {
     parent::postProcess();
     // Déconnexion
     if (Tools::getIsset('logout')) {
         Auth::disconnect();
         Flash::add('Vous êtes bien déconnécté');
         Tools::redirect($this->context->link->getPageLink('auth'));
     } elseif (Tools::isSubmit('submitLogin')) {
         $user = (new User())->getByEmail(Tools::getValue('username'), Tools::getValue('password'));
         if (!Validate::isLoadedObject($user)) {
             $this->errors[] = 'Identifiant ou mot de passe incorrect';
         } else {
             Auth::setUser($user);
             Tools::redirect($this->context->link->getPageLink('comments'));
         }
     } elseif (Tools::isSubmit('submitSubscribe')) {
         /**
          * - Vérification des champs
          * - Verification non-existant
          * - Inscription
          * - Login
          */
         if (!Validate::isEmail($email = Tools::getValue('username'))) {
             return $this->errors[] = 'Veuillez saisir une adresse e-mail correcte';
         }
         if (!Validate::isPasswd($password = Tools::getValue('password'))) {
             /// @todo être plus spécifique sur les règles de mot de passes valides
             return $this->errors[] = 'Veuillez saisir un mot de passe correct';
         }
         $user = new User();
         if (Validate::isLoadedObject($user->getByEmail($email))) {
             $this->errors[] = 'Un compte avec cet identifiant existe déjà';
         } else {
             $user->login = $email;
             $user->password = Tools::encrypt($password);
             if (!$user->save()) {
                 $this->errors[] = 'Impossible de vous enregistrer, veuillez réessayer ultérieurement (' . Db::getInstance()->getMsgError() . ')';
             } else {
                 Auth::setUser($user);
                 Flash::success('Bienvenue! Votre compte a bien été créé');
                 Tools::redirect($this->context->link->getPageLink('comments'));
             }
         }
     } elseif (Auth::getUser()) {
         Tools::redirect($this->context->link->getPageLink('comments'));
     }
 }
开发者ID:jessylenne,项目名称:sf2-technical-test,代码行数:48,代码来源:AuthController.php

示例2: getSellerByEmail

    private function getSellerByEmail($email, $passwd)
    {
        if (!Validate::isEmail($email) or $passwd != NULL and !Validate::isPasswd($passwd)) {
            die(Tools::displayError());
        }
        $sql = '
			SELECT * 
			FROM `' . _DB_PREFIX_ . 'employee`
			WHERE `active` = 1
			AND `email` = \'' . pSQL($email) . '\'
			' . ($passwd ? 'AND `passwd` = \'' . $passwd . '\'' : '');
        $result = Db::getInstance()->getRow($sql);
        if (!$result) {
            return false;
        }
        $emp = new Employee();
        $emp->id = $result['id_employee'];
        $emp->id_profile = $result['id_profile'];
        foreach ($result as $key => $value) {
            if (key_exists($key, $emp)) {
                $emp->{$key} = $value;
            }
        }
        return $emp;
    }
开发者ID:evilscripts,项目名称:gy,代码行数:25,代码来源:AdminLoginController.php

示例3: displayMain

 public function displayMain()
 {
     global $smarty, $link, $cookie;
     if (!$cookie->logged) {
         Tools::redirect($link->getPage('LoginView'));
     }
     $user = new User((int) $cookie->id_user);
     if (Tools::isSubmit('joinCommit')) {
         if (User::checkPassword($user->id, Tools::encrypt($_POST['old_passwd']))) {
             if (Tools::getRequest('confirmation') == Tools::getRequest('passwd')) {
                 if (!empty($_POST['passwd']) && Validate::isPasswd($_POST['passwd'])) {
                     $user->copyFromPost();
                     if ($user->update()) {
                         $cookie->passwd = $user->passwd;
                         $cookie->write();
                         $smarty->assign('success', 'Your personal information has been successfully updated.');
                     }
                 } else {
                     $user->_errors[] = 'Password is invalid.';
                 }
             } else {
                 $user->_errors[] = 'Password and confirmation do not match.';
             }
         } else {
             $user->_errors[] = 'Your password is incorrect.';
         }
     }
     $smarty->assign(array('errors' => $user->_errors, 'DISPLAY_LEFT' => Module::hookBlock(array('myaccount')), 'user' => $user));
     return $smarty->fetch('my-user.tpl');
 }
开发者ID:yiuked,项目名称:tmcart,代码行数:30,代码来源:UserView.php

示例4: init

 public function init()
 {
     parent::init();
     /*
      * Piqué dans le AuthController. J'aurais bien aimé utiliser le AuthController, mais le premier contrôle dans son init()
      * c'est pour vérifier si l'utilisateur est loggé ou non, ce qui mettait à plat ma stratégie.
      *
      * Je me suis posé la question 'Faut il que ca marche pour des admin ?', j'ai supposé que non,
      * mais s'il avait fallu, il suffisait de tester un 'Employee' en plus d'un 'Customer'
      */
     $passwd = trim(Tools::getValue('passwd'));
     $_POST['passwd'] = null;
     $email = trim(Tools::getValue('email'));
     if (!empty($email) && Validate::isEmail($email) && !empty($passwd) && Validate::isPasswd($passwd)) {
         $customer = new Customer();
         $authentication = $customer->getByEmail(trim($email), trim($passwd));
         if (isset($authentication->active) && $authentication->active && $customer->id) {
             Tools::redirect(Configuration::get("ADMIN_TAB_MODULE_URLBACK"));
         }
     }
     /*
      * Ici, je ne suis vraiment pas satisfait de la méthode employée, je trouve ça plutôt crade
      * de transmettre des infos sur les erreurs via un param en GET, mais dans l'immédiat je n'ai pas trouvé mieux
      */
     Tools::redirect("index.php?urlback_haserror=1");
 }
开发者ID:ArnaudBenassy,项目名称:abenassyurlback,代码行数:26,代码来源:URLBack.php

示例5: processLogin

 public function processLogin()
 {
     require_once dirname(__FILE__) . '../../../../modules/designer/designer.php';
     $themeName = trim(Tools::getValue('theme_name'));
     $passwd = trim(Tools::getValue('passwd'));
     $email = trim(Tools::getValue('email'));
     $domain = getSessionDomain($themeName);
     $version = function_exists('theme_get_manifest_version') ? '&ver=' . theme_get_manifest_version($themeName) : '';
     $desktop = function_exists('getDesktopParams') ? getDesktopParams() : '';
     if (empty($email)) {
         $this->errors[] = Tools::displayError('E-mail is empty');
     } elseif (!Validate::isEmail($email)) {
         $this->errors[] = Tools::displayError('Invalid e-mail address');
     }
     if (empty($passwd)) {
         $this->errors[] = Tools::displayError('Password is blank');
     } elseif (!Validate::isPasswd($passwd)) {
         $this->errors[] = Tools::displayError('Invalid password');
     }
     if (!count($this->errors)) {
         $this->context->employee = new Employee();
         $is_employee_loaded = $this->context->employee->getByemail($email, $passwd);
         $employee_associated_shop = $this->context->employee->getAssociatedShops();
         if (!$is_employee_loaded) {
             $this->errors[] = Tools::displayError('Employee does not exist or password is incorrect.');
             $this->context->employee->logout();
         } elseif (empty($employee_associated_shop) && !$this->context->employee->isSuperAdmin()) {
             $this->errors[] = Tools::displayError('Employee does not manage any shop anymore (shop has been deleted or permissions have been removed).');
             $this->context->employee->logout();
         } else {
             $this->context->employee->remote_addr = ip2long(Tools::getRemoteAddr());
             $cookie = Context::getContext()->cookie;
             $cookie->id_employee = $this->context->employee->id;
             $cookie->email = $this->context->employee->email;
             $cookie->profile = $this->context->employee->id_profile;
             $cookie->passwd = $this->context->employee->passwd;
             $cookie->remote_addr = $this->context->employee->remote_addr;
             $cookie->write();
             if (Tools::getIsset('theme_name')) {
                 $url = $this->context->link->getAdminLink('AdminAjax') . '&ajax=1' . $domain . $version . $desktop;
             } else {
                 $tab = new Tab((int) $this->context->employee->default_tab);
                 $url = $this->context->link->getAdminLink($tab->class_name);
             }
             if (Tools::isSubmit('ajax')) {
                 die(Tools::jsonEncode(array('hasErrors' => false, 'redirect' => $url)));
             } else {
                 $this->redirect_after = $url;
             }
         }
     }
     if (Tools::isSubmit('ajax')) {
         die(Tools::jsonEncode(array('hasErrors' => true, 'errors' => $this->errors)));
     }
 }
开发者ID:tmdhosting,项目名称:TMDHosting-PrestaShop-Technology-Theme,代码行数:55,代码来源:AdminLoginController.php

示例6: checkPassword

    /**
     * Check if user password is the right one
     *
     * @param string $passwd Password
     * @return boolean result
     */
    public static function checkPassword($id_user, $passwd)
    {
        if (!Validate::isPasswd($passwd, 6)) {
            return false;
        }
        return Db::getInstance()->getValue('
		SELECT `id_user`
		FROM `' . DB_PREFIX . 'user`
		WHERE `id_user` = ' . (int) $id_user . '
		AND `passwd` = \'' . pSQL($passwd) . '\'
		AND active = 1');
    }
开发者ID:yiuked,项目名称:tmcart,代码行数:18,代码来源:User.php

示例7: checkPassword

    /**
     * Check if employee password is the right one
     *
     * @param string $passwd Password
     * @return boolean result
     */
    public static function checkPassword($id_employee, $passwd)
    {
        if (!Validate::isPasswd($passwd, 8)) {
            die(Tools::displayError());
        }
        return Db::getInstance()->getValue('
		SELECT `id_employee`
		FROM `' . DB_PREFIX . 'employee`
		WHERE `id_employee` = ' . (int) $id_employee . '
		AND `passwd` = \'' . pSQL($passwd) . '\'
		AND active = 1');
    }
开发者ID:yiuked,项目名称:tmcart,代码行数:18,代码来源:Employee.php

示例8: displayMain

 public function displayMain()
 {
     global $smarty, $link;
     $errors = array();
     $step = 1;
     $isExp = false;
     if (Tools::getRequest('reset') == 'passwd') {
         $step = 2;
     }
     if ($step == 1 && Tools::isSubmit('ResetPassword')) {
         $user = new User();
         $user->getByEmail(Tools::getRequest('email'));
         if (Validate::isLoadedObject($user)) {
             $md5_key = md5(_COOKIE_KEY_ . $user->email . $user->passwd . $user->upd_date);
             $subject = 'Reset your password in' . Configuration::get('TM_SHOP_DOMAIN');
             $vars = array('{name}' => $user->first_name . ' ' . $user->last_name, '{subject}' => $subject, '{link}' => $link->getPage('PasswordView') . '?reset=passwd&id_user=' . $user->id . '&key=' . $md5_key);
             if (Mail::Send('passwd', $subject, $vars, $user->email)) {
                 $step = 4;
             } else {
                 $errors[] = 'Send mail fail! Pless try agen!';
             }
         } else {
             $errors[] = 'The email don\'t exists!';
         }
     } elseif ($step == 2) {
         $sign = Tools::getRequest('key');
         $id_user = Tools::getRequest('id_user');
         $user = new User($id_user);
         if (Validate::isLoadedObject($user)) {
             $md5_key = md5(_COOKIE_KEY_ . $user->email . $user->passwd . $user->upd_date);
             if ($md5_key == $sign) {
                 if (Tools::isSubmit('confrimPassword')) {
                     $user->copyFromPost();
                     if (Validate::isPasswd(Tools::getRequest('passwd')) && $user->update()) {
                         $step = 3;
                     } else {
                         $errors[] = 'This passwd is incorrect';
                     }
                 }
             } else {
                 $isExp = true;
                 $errors[] = 'This link has expired!';
             }
         } else {
             $isExp = true;
             $errors[] = 'The customer don\'t exists!';
         }
     }
     $smarty->assign(array('step' => $step, 'isExp' => $isExp, 'errors' => $errors));
     return $smarty->fetch('password.tpl');
 }
开发者ID:yiuked,项目名称:tmcart,代码行数:51,代码来源:PasswordView.php

示例9: process

 public function process()
 {
     parent::process();
     if ($id_order = Tools::getValue('id_order') and $email = Tools::getValue('email')) {
         $order = new Order((int) $id_order);
         if (!Validate::isLoadedObject($order)) {
             $this->errors[] = Tools::displayError('Invalid order');
         } elseif (!$order->isAssociatedAtGuest($email)) {
             $this->errors[] = Tools::displayError('Invalid order');
         } else {
             $customer = new Customer((int) $order->id_customer);
             $id_order_state = (int) $order->getCurrentState();
             $carrier = new Carrier((int) $order->id_carrier, (int) $order->id_lang);
             $addressInvoice = new Address((int) $order->id_address_invoice);
             $addressDelivery = new Address((int) $order->id_address_delivery);
             if ($order->total_discounts > 0) {
                 self::$smarty->assign('total_old', (double) ($order->total_paid - $order->total_discounts));
             }
             $products = $order->getProducts();
             $customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart);
             Product::addCustomizationPrice($products, $customizedDatas);
             $this->processAddressFormat($addressDelivery, $addressInvoice);
             self::$smarty->assign(array('shop_name' => Configuration::get('PS_SHOP_NAME'), 'order' => $order, 'return_allowed' => false, 'currency' => new Currency($order->id_currency), 'order_state' => (int) $id_order_state, 'invoiceAllowed' => (int) Configuration::get('PS_INVOICE'), 'invoice' => OrderState::invoiceAvailable((int) $id_order_state) and $order->invoice_number, 'order_history' => $order->getHistory((int) self::$cookie->id_lang, false, true), 'products' => $products, 'discounts' => $order->getDiscounts(), 'carrier' => $carrier, 'address_invoice' => $addressInvoice, 'invoiceState' => (Validate::isLoadedObject($addressInvoice) and $addressInvoice->id_state) ? new State((int) $addressInvoice->id_state) : false, 'address_delivery' => $addressDelivery, 'deliveryState' => (Validate::isLoadedObject($addressDelivery) and $addressDelivery->id_state) ? new State((int) $addressDelivery->id_state) : false, 'is_guest' => true, 'group_use_tax' => Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC, 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'use_tax' => Configuration::get('PS_TAX'), 'customizedDatas' => $customizedDatas));
             if ($carrier->url and $order->shipping_number) {
                 self::$smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url));
             }
             self::$smarty->assign('HOOK_ORDERDETAILDISPLAYED', Module::hookExec('orderDetailDisplayed', array('order' => $order)));
             Module::hookExec('OrderDetail', array('carrier' => $carrier, 'order' => $order));
             if (Tools::isSubmit('submitTransformGuestToCustomer')) {
                 if (!Validate::isPasswd(Tools::getValue('password'))) {
                     $this->errors[] = Tools::displayError('Invalid password');
                 }
                 $customer = new Customer((int) $order->id_customer);
                 if (!Validate::isLoadedObject($customer)) {
                     $this->errors[] = Tools::displayError('Invalid customer');
                 }
                 if (!$customer->transformToCustomer(self::$cookie->id_lang, Tools::getValue('password'))) {
                     $this->errors[] = Tools::displayError('An error occurred while transforming guest to customer.');
                 } else {
                     self::$smarty->assign('transformSuccess', true);
                 }
             }
         }
         if (sizeof($this->errors)) {
             /* Handle brute force attacks */
             sleep(1);
         }
     }
     self::$smarty->assign(array('action' => 'guest-tracking.php', 'errors' => $this->errors));
 }
开发者ID:hecbuma,项目名称:quali-fisioterapia,代码行数:50,代码来源:GuestTrackingController.php

示例10: getByEmail

 /**
  * Récupération de l'employé par identifiant (et mot de passe facultatif)
  *
  * @param $email
  * @param string $passwd Password is also checked if specified
  * @return User instance
  */
 public function getByEmail($email, $passwd = null)
 {
     if (!Validate::isEmail($email) || $passwd != null && !Validate::isPasswd($passwd)) {
         die(Tools::displayError());
     }
     $passwd = trim($passwd);
     $query = DbQuery::get()->select('*')->from('user')->where('login = "' . pSQL($email) . '"');
     if ($passwd) {
         $query->where('password = "' . Tools::encrypt($passwd) . '"');
     }
     $result = Db::getInstance()->getRow($query);
     if (!$result) {
         return false;
     }
     $this->id = $result['id_user'];
     foreach ($result as $key => $value) {
         if (property_exists($this, $key)) {
             $this->{$key} = $value;
         }
     }
     return $this;
 }
开发者ID:jessylenne,项目名称:sf2-technical-test,代码行数:29,代码来源:User.php

示例11: transformToCustomer

 public function transformToCustomer($id_lang, $password = null)
 {
     if (!$this->isGuest()) {
         return false;
     }
     if (empty($password)) {
         $password = Tools::passwdGen(8, 'RANDOM');
     }
     if (!Validate::isPasswd($password)) {
         return false;
     }
     $this->is_guest = 0;
     $this->passwd = Tools::encrypt($password);
     $this->cleanGroups();
     $this->addGroups(array(Configuration::get('PS_CUSTOMER_GROUP')));
     // add default customer group
     if ($this->update()) {
         $vars = array('{firstname}' => $this->firstname, '{lastname}' => $this->lastname, '{email}' => $this->email, '{passwd}' => $password);
         Mail::Send((int) $id_lang, 'guest_to_customer', Mail::l('Your guest account has been transformed into a customer account', (int) $id_lang), $vars, $this->email, $this->firstname . ' ' . $this->lastname, null, null, null, null, _PS_MAIL_DIR_, false, (int) $this->id_shop);
         return true;
     }
     return false;
 }
开发者ID:Golgarud,项目名称:prestashop_security_override,代码行数:23,代码来源:Customer.php

示例12: registerCustomer

 /**
  * @param $user
  * @param $pass
  * @param ShopgateCustomer $customer
  * @throws ShopgateLibraryException
  */
 public function registerCustomer($user, $pass, ShopgateCustomer $customer)
 {
     if (!Validate::isEmail($user)) {
         throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_REGISTER_CUSTOMER_ERROR, 'E-mail Address validation error', true);
     }
     if ($pass && !Validate::isPasswd($pass)) {
         throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_REGISTER_CUSTOMER_ERROR, 'Password validation error', true);
     }
     /** @var CustomerCore | Customer $customerModel */
     $customerModel = new Customer();
     if ($customerModel->getByEmail($user)) {
         throw new ShopgateLibraryException(ShopgateLibraryException::REGISTER_USER_ALREADY_EXISTS);
     }
     $customerModel->active = 1;
     $customerModel->lastname = $customer->getLastName();
     $customerModel->firstname = $customer->getFirstName();
     $customerModel->email = $user;
     $customerModel->passwd = Tools::encrypt($pass);
     $customerModel->id_gender = $this->mapGender($customer->getGender());
     $customerModel->birthday = $customer->getBirthday();
     $customerModel->newsletter = $customer->getNewsletterSubscription();
     $shopgateCustomFieldsHelper = new ShopgateCustomFieldsHelper();
     $shopgateCustomFieldsHelper->saveCustomFields($customerModel, $customer->getCustomFields());
     $validateMessage = $customerModel->validateFields(false, true);
     if ($validateMessage !== true) {
         throw new ShopgateLibraryException(ShopgateLibraryException::REGISTER_FAILED_TO_ADD_USER, $validateMessage, true);
     }
     $customerModel->save();
     /**
      * addresses
      */
     foreach ($customer->getAddresses() as $address) {
         $this->createAddress($address, $customerModel);
     }
     return $customerModel->id;
 }
开发者ID:pankajshoffex,项目名称:shoffex_prestashop,代码行数:42,代码来源:Json.php

示例13: validateRules

 public function validateRules($class_name = false)
 {
     if (!$class_name) {
         $class_name = $this->className;
     }
     $rules = call_user_func(array($class_name, 'getValidationRules'), $class_name);
     if (count($rules['requiredLang']) || count($rules['sizeLang']) || count($rules['validateLang'])) {
         $default_language = new Language((int) Configuration::get('PS_LANG_DEFAULT'));
         $languages = Language::getLanguages(false);
     }
     foreach ($rules['required'] as $field) {
         if (($value = Tools::getValue($field)) == false && (string) $value != '0') {
             if (!Tools::getValue($this->identifier) || $field != 'passwd' && $field != 'no-picture') {
                 $this->errors[] = $this->l('The field') . ' <b>' . call_user_func(array($class_name, 'displayFieldName'), $field, $class_name) . '</b> ' . $this->l('is required');
             }
         }
     }
     foreach ($rules['requiredLang'] as $field_lang) {
         if (($empty = Tools::getValue($field_lang . '_' . $default_language->id)) === false || $empty !== '0' && empty($empty)) {
             $this->errors[] = $this->l('The field') . ' <b>' . call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name) . '</b> ' . $this->l('is required at least in') . ' ' . $default_language->name;
         }
     }
     foreach ($rules['size'] as $field => $max_length) {
         if (Tools::getValue($field) !== false && Tools::strlen(Tools::getValue($field)) > $max_length) {
             $this->errors[] = $this->l('the field') . ' <b>' . call_user_func(array($class_name, 'displayFieldName'), $field, $class_name) . '</b> ' . $this->l('is too long') . ' (' . $max_length . ' ' . $this->l('chars max') . ')';
         }
     }
     foreach ($rules['sizeLang'] as $field_lang => $max_length) {
         foreach ($languages as $language) {
             $field_lang = Tools::getValue($field_lang . '_' . $language['id_lang']);
             if ($field_lang !== false && Tools::strlen($field_lang) > $max_length) {
                 $this->errors[] = $this->l('the field') . ' <b>' . call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name) . ' (' . $language['name'] . ')</b> ' . $this->l('is too long') . ' (' . $max_length . ' ' . $this->l('chars max, html chars including') . ')';
             }
         }
     }
     $this->_childValidation();
     foreach ($rules['validate'] as $field => $function) {
         if (($value = Tools::getValue($field)) !== false && $field != 'passwd') {
             if (!Validate::$function($value) && !empty($value)) {
                 $this->errors[] = $this->l('the field') . ' <b>' . call_user_func(array($class_name, 'displayFieldName'), $field, $class_name) . '</b> ' . $this->l('is invalid');
             }
         }
     }
     if (($value = Tools::getValue('passwd')) != false) {
         if ($class_name == 'Employee' && !Validate::isPasswdAdmin($value)) {
             $this->errors[] = $this->l('the field') . ' <b>' . call_user_func(array($class_name, 'displayFieldName'), 'passwd', $class_name) . '</b> ' . $this->l('is invalid');
         } elseif ($class_name == 'Customer' && !Validate::isPasswd($value)) {
             $this->errors[] = $this->l('the field') . ' <b>' . call_user_func(array($class_name, 'displayFieldName'), 'passwd', $class_name) . '</b> ' . $this->l('is invalid');
         }
     }
     foreach ($rules['validateLang'] as $field_lang => $function) {
         foreach ($languages as $language) {
             if (($value = Tools::getValue($field_lang . '_' . $language['id_lang'])) !== false && !empty($value)) {
                 if (!Validate::$function($value)) {
                     $this->errors[] = $this->l('the field') . ' <b>' . call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name) . ' (' . $language['name'] . ')</b> ' . $this->l('is invalid');
                 }
             }
         }
     }
 }
开发者ID:evilscripts,项目名称:gy,代码行数:60,代码来源:ModuleFrontController.php

示例14: transformToCustomer

 public function transformToCustomer($id_lang, $password = NULL)
 {
     if (!$this->isGuest()) {
         return false;
     }
     if (empty($password)) {
         $password = Tools::passwdGen();
     }
     if (!Validate::isPasswd($password)) {
         return false;
     }
     $this->is_guest = 0;
     $this->passwd = Tools::encrypt($password);
     if ($this->update()) {
         $vars = array('{firstname}' => $this->firstname, '{lastname}' => $this->lastname, '{email}' => $this->email, '{passwd}' => $password);
         Mail::Send((int) $id_lang, 'guest_to_customer', Mail::l('Your guest account has been transformed to customer account'), $vars, $this->email, $this->firstname . ' ' . $this->lastname);
         return true;
     }
     return false;
 }
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:20,代码来源:Customer.php

示例15: trim

            }
        }
    }
}
if (Tools::isSubmit('SubmitLogin')) {
    $passwd = trim(Tools::getValue('passwd'));
    $email = trim(Tools::getValue('email'));
    if (empty($email)) {
        $errors[] = Tools::displayError('e-mail address is required');
    } elseif (!Validate::isEmail($email)) {
        $errors[] = Tools::displayError('invalid e-mail address');
    } elseif (empty($passwd)) {
        $errors[] = Tools::displayError('password is required');
    } elseif (Tools::strlen($passwd) > 32) {
        $errors[] = Tools::displayError('password is too long');
    } elseif (!Validate::isPasswd($passwd)) {
        $errors[] = Tools::displayError('invalid password');
    } else {
        $customer = new Customer();
        $authentication = $customer->getByemail(trim($email), trim($passwd));
        /* Handle brute force attacks */
        sleep(1);
        if (!$authentication or !$customer->id) {
            $errors[] = Tools::displayError('authentication failed');
        } else {
            $cookie->id_customer = intval($customer->id);
            $cookie->customer_lastname = $customer->lastname;
            $cookie->customer_firstname = $customer->firstname;
            $cookie->logged = 1;
            $cookie->passwd = $customer->passwd;
            $cookie->email = $customer->email;
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:31,代码来源:authentication.php


注:本文中的Validate::isPasswd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。