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


PHP Util::randomPassword方法代码示例

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


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

示例1: indexAction

 public function indexAction(Request $request, SessionInterface $session)
 {
     Util::checkUserIsLoggedInAndRedirect();
     $clientDomain = $session->get('client/company_domain');
     $organizationId = $request->query->get('id');
     $errors = array('empty_email' => false, 'email_not_valid' => false, 'email_already_exists' => false);
     $organizations = $this->getRepository(Organization::class)->getByClientId($session->get('client/id'));
     if ($request->request->has('confirm_new_customer')) {
         $email = Util::cleanRegularInputField($request->request->get('email'));
         $firstName = Util::cleanRegularInputField($request->request->get('first_name'));
         $lastName = Util::cleanRegularInputField($request->request->get('last_name'));
         if (empty($email)) {
             $errors['empty_email'] = true;
         } else {
             if (!Util::isValidEmail($email)) {
                 $errors['email_not_valid'] = true;
             }
         }
         $emailData = $this->getRepository(UbirimiUser::class)->getUserByClientIdAndEmailAddress($session->get('client/id'), mb_strtolower($email));
         if ($emailData) {
             $errors['email_already_exists'] = true;
         }
         if (Util::hasNoErrors($errors)) {
             $password = Util::randomPassword(8);
             $userId = UbirimiContainer::get()['user']->newUser(array('clientId' => $session->get('client/id'), 'firstName' => $firstName, 'lastName' => $lastName, 'password' => $password, 'email' => $email, 'isCustomer' => true, 'clientDomain' => $session->get('client/company_domain')));
             if ($organizationId) {
                 $this->getRepository(Customer::class)->create($organizationId, $userId);
                 return new RedirectResponse('/helpdesk/administration/customers?id=' . $organizationId);
             }
             return new RedirectResponse('/helpdesk/administration/customers');
         }
     }
     $menuSelectedCategory = 'general_user';
     $sectionPageTitle = $session->get('client/settings/title_name') . ' / GeneralSettings Settings / Create User';
     return $this->render(__DIR__ . '/../../../Resources/views/administration/customer/Add.php', get_defined_vars());
 }
开发者ID:spiasecki,项目名称:ubirimi,代码行数:36,代码来源:AddController.php

示例2: updatePasswordForClientAdministrator

 public static function updatePasswordForClientAdministrator($userId)
 {
     $query = 'update general_user set password = ? where id = ? and client_administrator_flag = 1 limit 1';
     $pass = Util::randomPassword(8);
     $hash = UbirimiContainer::get()['password']->hash($pass);
     $stmt = UbirimiContainer::get()['db.connection']->prepare($query);
     $stmt->bind_param("si", $hash, $userId);
     $stmt->execute();
     return $pass;
 }
开发者ID:spiasecki,项目名称:ubirimi,代码行数:10,代码来源:Util.php


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