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


PHP jAuth::getRandomPassword方法代码示例

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


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

示例1: index

 function index()
 {
     $id = $this->param('j_user_login');
     if ($id === null) {
         $rep = $this->getResponse('redirect');
         $rep->action = 'master_admin~default:index';
         return $rep;
     }
     if ($this->personalView && $id != jAuth::getUserSession()->login) {
         jMessage::add(jLocale::get('jelix~errors.acl.action.right.needed'), 'error');
         $rep = $this->getResponse('redirect');
         $rep->action = 'master_admin~default:index';
         return $rep;
     }
     $rep = $this->getResponse('html');
     $tpl = new jTpl();
     $tpl->assign('id', $id);
     $tpl->assign('randomPwd', jAuth::getRandomPassword());
     $tpl->assign('personalview', $this->personalView);
     if ($this->personalView) {
         $tpl->assign('viewaction', 'user:index');
     } else {
         $tpl->assign('viewaction', 'default:view');
     }
     $rep->body->assign('MAIN', $tpl->fetch('password_change'));
     return $rep;
 }
开发者ID:Calmacil,项目名称:ffdvh,代码行数:27,代码来源:password.classic.php

示例2: install

 function install()
 {
     if (self::$key === null) {
         self::$key = jAuth::getRandomPassword(30, true);
     }
     $authconfig = $this->config->getValue('auth', 'coordplugins');
     $authconfigMaster = $this->config->getValue('auth', 'coordplugins', null, true);
     $forWS = in_array($this->entryPoint->type, array('json', 'jsonrpc', 'soap', 'xmlrpc'));
     if (!$authconfig || $forWS && $authconfig == $authconfigMaster) {
         if ($forWS) {
             $pluginIni = 'authsw.coord.ini.php';
         } else {
             $pluginIni = 'auth.coord.ini.php';
         }
         $authconfig = dirname($this->entryPoint->configFile) . '/' . $pluginIni;
         if ($this->firstExec('auth:' . $authconfig)) {
             // no configuration, let's install the plugin for the entry point
             $this->config->setValue('auth', $authconfig, 'coordplugins');
             if (!file_exists(jApp::configPath($authconfig))) {
                 $this->copyFile('var/config/' . $pluginIni, jApp::configPath($authconfig));
             }
         }
     }
     $localConfigIni = $this->entryPoint->localConfigIni;
     $key = $localConfigIni->getValue('persistant_crypt_key', 'coordplugin_auth');
     if ($key === 'exampleOfCryptKey' || $key == '') {
         $localConfigIni->getMaster()->setValue('persistant_crypt_key', self::$key, 'coordplugin_auth');
     }
 }
开发者ID:laurentj,项目名称:lizmap-web-client,代码行数:29,代码来源:install.php

示例3: install

 function install()
 {
     if (self::$key === null) {
         self::$key = jAuth::getRandomPassword(30, true);
     }
     $conf = $this->config->getValue('auth', 'coordplugins');
     if ($conf != '1') {
         $conff = jApp::configPath($conf);
         if (file_exists($conff)) {
             $ini = new jIniFileModifier($conff);
             $ini->removeValue('persistant_crypt_key');
             $ini->save();
         }
     }
     $localConfigIni = $this->entryPoint->localConfigIni;
     $localConfigIni->getMaster()->setValue('persistant_crypt_key', self::$key, 'coordplugin_auth');
 }
开发者ID:laurentj,项目名称:lizmap-web-client,代码行数:17,代码来源:upgrade_changepersistantkey.php

示例4: send

 /**
  * send a new password 
  */
 function send()
 {
     $repError = $this->_check();
     if ($repError) {
         return $repError;
     }
     $rep = $this->getResponse("redirect");
     $rep->action = "password:index";
     $form = jForms::fill('password');
     if (!$form->check()) {
         return $rep;
     }
     $login = $form->getData('pass_login');
     $user = jAuth::getUser($login);
     if (!$user) {
         $form->setErrorOn('pass_login', jLocale::get('password.login.doesnt.exist'));
         return $rep;
     }
     if ($user->email != $form->getData('pass_email')) {
         $form->setErrorOn('pass_email', jLocale::get('password.email.unknown'));
         return $rep;
     }
     $pass = jAuth::getRandomPassword(8);
     $key = substr(md5($login . '-' . $pass), 1, 10);
     $user->status = JCOMMUNITY_STATUS_PWD_CHANGED;
     $user->request_date = date('Y-m-d H:i:s');
     $user->keyactivate = $key;
     jAuth::updateUser($user);
     $mail = new jMailer();
     $mail->From = jApp::config()->mailer['webmasterEmail'];
     $mail->FromName = jApp::config()->mailer['webmasterName'];
     $mail->Sender = jApp::config()->mailer['webmasterEmail'];
     $mail->Subject = jLocale::get('password.mail.pwd.change.subject');
     $tpl = new jTpl();
     $tpl->assign(compact('login', 'pass', 'key'));
     $tpl->assign('server', $_SERVER['SERVER_NAME']);
     $mail->Body = $tpl->fetch('mail_password_change', 'text');
     $mail->AddAddress($user->email);
     //$mail->SMTPDebug = true;
     $mail->Send();
     jForms::destroy('password');
     $rep->action = "password:confirmform";
     return $rep;
 }
开发者ID:jelix,项目名称:jcommunity-module,代码行数:47,代码来源:password.classic.php

示例5: index

 function index()
 {
     $id = $this->param('id');
     if ($id === null) {
         $rep = $this->getResponse('redirect');
         $rep->action = 'master_admin~default:index';
         return $rep;
     }
     $rep = $this->getResponse('html');
     $tpl = new jTpl();
     $tpl->assign('id', $id);
     $tpl->assign('randomPwd', jAuth::getRandomPassword());
     $tpl->assign('personalview', $this->personalView);
     if ($this->personalView) {
         $tpl->assign('viewaction', 'user:index');
     } else {
         $tpl->assign('viewaction', 'default:view');
     }
     $rep->body->assign('MAIN', $tpl->fetch('password_change'));
     return $rep;
 }
开发者ID:alienpham,项目名称:helenekling,代码行数:21,代码来源:password.classic.php

示例6: save

 /**
  * save new user and send an email for a confirmation, with
  * a key to activate the account
  */
 function save()
 {
     if (jAuth::isConnected()) {
         return $this->noaccess();
     }
     $rep = $this->getResponse("redirect");
     $rep->action = "registration:index";
     $form = jForms::get('registration');
     if (!$form) {
         return $rep;
     }
     jEvent::notify('jcommunity_registration_init_form', array('form' => $form));
     $form->initFromRequest();
     if (!$form->check()) {
         return $rep;
     }
     $login = $form->getData('reg_login');
     if (jAuth::getUser($login)) {
         $form->setErrorOn('reg_login', jLocale::get('register.form.login.exists'));
         return $rep;
     }
     $pass = jAuth::getRandomPassword(8);
     $key = substr(md5($login . '-' . $pass), 1, 10);
     $user = jAuth::createUserObject($login, $pass);
     $user->email = $form->getData('reg_email');
     $user->nickname = $login;
     $user->status = JCOMMUNITY_STATUS_NEW;
     $user->request_date = date('Y-m-d H:i:s');
     $user->keyactivate = $key;
     $ev = jEvent::notify('jcommunity_registration_prepare_save', array('form' => $form, 'user' => $user));
     if (count($form->getErrors())) {
         return $rep;
     }
     $responses = $ev->getResponse();
     $hasErrors = false;
     foreach ($responses as $response) {
         if (isset($response['errorRegistration']) && $response['errorRegistration'] != "") {
             jMessage::add($response['errorRegistration'], 'error');
             $hasErrors = true;
         }
     }
     if ($hasErrors) {
         return $rep;
     }
     jAuth::saveNewUser($user);
     jEvent::notify('jcommunity_registration_after_save', array('form' => $form, 'user' => $user));
     $gJConfig = jApp::config();
     $mail = new jMailer();
     $mail->From = $gJConfig->mailer['webmasterEmail'];
     $mail->FromName = $gJConfig->mailer['webmasterName'];
     $mail->Sender = $gJConfig->mailer['webmasterEmail'];
     $mail->Subject = jLocale::get('register.mail.new.subject');
     $tpl = new jTpl();
     $tpl->assign(compact('login', 'pass', 'key'));
     $tpl->assign('server', $_SERVER['SERVER_NAME']);
     $mail->Body = $tpl->fetch('mail_registration', 'text');
     $mail->AddAddress($user->email);
     $mail->Send();
     jForms::destroy('registration');
     $rep->action = "registration:confirmform";
     $rep->params = array('login' => $login);
     return $rep;
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:67,代码来源:registration.classic.php

示例7: create

 /**
  * display a form to create a record
  */
 function create()
 {
     $form = jForms::get($this->form);
     if ($form == null) {
         $form = jForms::create($this->form);
     }
     $rep = $this->getResponse('html');
     $tpl = new jTpl();
     $tpl->assign('id', null);
     $tpl->assign('form', $form);
     $tpl->assign('randomPwd', jAuth::getRandomPassword());
     jEvent::notify('jauthdbAdminEditCreate', array('form' => $form, 'tpl' => $tpl));
     $rep->body->assign('MAIN', $tpl->fetch('crud_edit'));
     return $rep;
 }
开发者ID:alienpham,项目名称:helenekling,代码行数:18,代码来源:default.classic.php


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