本文整理汇总了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());
}
示例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;
}