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


PHP jAuth::changePassword方法代码示例

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


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

示例1: testAll

 public function testAll()
 {
     if ($this->config === null) {
         $this->sendMessage('Ldap plugin for jauth is not tested because there isn\'t configuration.' . ' To test it, you should create and configure an auth_ldap.coord.ini.php file.');
         return;
     }
     for ($i = 1; $i <= NB_USERS_LDAP; $i++) {
         $myUser = jAuth::createUserObject("testldap usr {$i}", "pass{$i}");
         $this->assertTrue($myUser instanceof jAuthUserLDAP);
         jAuth::saveNewUser($myUser);
         $myUserLDAP = jAuth::getUser("testldap usr {$i}");
         $user = "\n            <object class=\"jAuthUserLDAP\">\n                <string property=\"login\" value=\"testldap usr {$i}\" />\n                <string property=\"email\" value=\"\" />\n                <array property=\"cn\">array('testldap usr {$i}')</array>\n                <array property=\"distinguishedName\">array('CN=testldap usr {$i},{$this->config['ldap']['searchBaseDN']}')</array>\n                <array property=\"name\">array('testldap usr {$i}')</array>\n                <string property=\"password\" value=\"\" />\n            </object>\n            ";
         $this->assertComplexIdenticalStr($myUserLDAP, $user);
         $myUser->email = "usr{$i}.testldap@domain.com";
         jAuth::updateUser($myUser);
         $myUserLDAP = jAuth::getUser("testldap usr {$i}");
         $user = "\n            <object>\n                <string property=\"login\" value=\"testldap usr {$i}\" />\n                <array property=\"email\">array('usr{$i}.testldap@domain.com')</array>\n                <array property=\"cn\">array('testldap usr {$i}')</array>\n                <array property=\"distinguishedName\">array('CN=testldap usr {$i},{$this->config['ldap']['searchBaseDN']}')</array>\n                <array property=\"name\">array('testldap usr {$i}')</array>\n                <string property=\"password\" value=\"\" />\n            </object>\n            ";
         $this->assertComplexIdenticalStr($myUserLDAP, $user);
         $this->assertTrue(jAuth::verifyPassword("testldap usr {$i}", "pass{$i}"));
         $this->assertTrue(jAuth::changePassword("testldap usr {$i}", "newpass{$i}"));
     }
     $myUsersLDAP = jAuth::getUserList('testldap usr*');
     $users = "<array>";
     for ($i = 1; $i <= NB_USERS_LDAP; $i++) {
         $users .= "\n            <object>\n                <array property=\"login\">array('testldap usr {$i}')</array>\n                <array property=\"email\">array('usr{$i}.testldap@domain.com')</array>\n                <array property=\"cn\">array('testldap usr {$i}')</array>\n                <array property=\"distinguishedName\">array('CN=testldap usr {$i},{$this->config['ldap']['searchBaseDN']}')</array>\n                <array property=\"name\">array('testldap usr {$i}')</array>\n                <string property=\"password\" value=\"\" />\n            </object>\n            ";
     }
     $users .= "</array>";
     $this->assertComplexIdenticalStr($myUsersLDAP, $users);
     for ($i = 1; $i <= NB_USERS_LDAP; $i++) {
         $this->assertTrue(jAuth::removeUser("testldap usr {$i}"));
     }
     $myUsersLDAP = jAuth::getUserList('testldap usr*');
     $this->assertFalse(count($myUsersLDAP) > 0);
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:34,代码来源:jauth.ldap_api.html.php

示例2: update

 /**
  * 
  */
 function update()
 {
     $id = $this->param('j_user_login');
     $pwd = $this->param('pwd');
     $pwdconf = $this->param('pwd_confirm');
     $rep = $this->getResponse('redirect');
     if ($this->personalView && $id != jAuth::getUserSession()->login) {
         jMessage::add(jLocale::get('jelix~errors.acl.action.right.needed'), 'error');
         $rep->action = 'master_admin~default:index';
         return $rep;
     }
     if (trim($pwd) == '' || $pwd != $pwdconf) {
         jMessage::add(jLocale::get('crud.message.bad.password'), 'error');
         $rep->action = 'password:index';
         $rep->params['j_user_login'] = $id;
         return $rep;
     }
     if (jAuth::changePassword($id, $pwd)) {
         jMessage::add(jLocale::get('crud.message.change.password.ok', $id), 'notice');
         if ($this->personalView) {
             $rep->action = 'user:index';
         } else {
             $rep->action = 'default:view';
         }
         $rep->params['j_user_login'] = $id;
         return $rep;
     } else {
         jMessage::add(jLocale::get('crud.message.change.password.notok'), 'error');
         $rep->action = 'password:index';
         $rep->params['j_user_login'] = $id;
     }
     return $rep;
 }
开发者ID:Calmacil,项目名称:ffdvh,代码行数:36,代码来源:password.classic.php

示例3: update

 /**
  * 
  */
 function update()
 {
     $id = $this->param('id');
     $pwd = $this->param('pwd');
     $pwdconf = $this->param('pwd_confirm');
     $rep = $this->getResponse('redirect');
     if (trim($pwd) == '' || $pwd != $pwdconf) {
         jMessage::add(jLocale::get('crud.message.bad.password'), 'error');
         $rep->action = 'password:index';
         $rep->params['id'] = $id;
         return $rep;
     }
     if (jAuth::changePassword($id, $pwd)) {
         jMessage::add(jLocale::get('crud.message.change.password.ok', $id), 'notice');
         if ($this->personalView) {
             $rep->action = 'user:index';
         } else {
             $rep->action = 'default:view';
         }
         $rep->params['id'] = $id;
         return $rep;
     } else {
         jMessage::add(jLocale::get('crud.message.change.password.notok'), 'error');
         $rep->action = 'password:index';
         $rep->params['id'] = $id;
     }
     return $rep;
 }
开发者ID:alienpham,项目名称:helenekling,代码行数:31,代码来源:password.classic.php

示例4: save

 /**
  *
  */
 function save()
 {
     $rep = $this->getResponse('json');
     //parametres
     $password = $this->param('password');
     $lastname = $this->param('lastname');
     $firstname = $this->param('firstname');
     $email = $this->param('email');
     //alert
     $success = false;
     $msg = "Profile non modifié";
     //verification
     //update
     if (!empty($firstname) && !empty($lastname) && jFilter::isEmail($email)) {
         // instanciation de la factory
         $user = jAuth::getUser(jAuth::getUserSession()->id);
         // infos user
         $user->lastname = $lastname;
         $user->firstname = $firstname;
         $user->email = $email;
         // on le sauvegarde dans la base
         try {
             jAuth::updateUser($user);
             if (!empty($password) && $user->password != $password) {
                 jAuth::changePassword($user->login, $password);
             }
             $success = true;
         } catch (Exception $e) {
             $success = false;
             $msg = "Profile non modifié";
         }
         if ($success) {
             $msg = "profile modifié ";
         }
     }
     $rep->data = array('success' => $success, 'msg' => $msg);
     return $rep;
 }
开发者ID:aurellemeless,项目名称:favoris,代码行数:41,代码来源:profile.classic.php

示例5: cryptUsersPassword

 function cryptUsersPassword()
 {
     $and = ' AND 1>2 ';
     $cnx = jDb::getConnection('jauthdb~jelixuser', 'jauth');
     $sql = "\n    SELECT u.usr_login, u.usr_password\n    FROM jlx_user u INNER JOIN lizlogin l\n    ON l.usr_password = u.usr_password AND l.usr_login = u.usr_login\n    WHERE 2>1\n    ";
     $sql .= $and;
     $res = $cnx->query($sql);
     foreach ($res as $rec) {
         jAuth::changePassword($rec->usr_login, $rec->usr_password);
     }
 }
开发者ID:laurentj,项目名称:lizmap-web-client,代码行数:11,代码来源:config.classic.php

示例6: confirm

 /**
  * activate a new password. the key should be given as a parameter
  */
 function confirm()
 {
     $repError = $this->_check();
     if ($repError) {
         return $repError;
     }
     $rep = $this->getResponse("redirect");
     $rep->action = "password:confirmform";
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
         return $rep;
     }
     $form = jForms::fill('confirmation');
     if ($form == null) {
         return $rep;
     }
     if (!$form->check()) {
         return $rep;
     }
     $login = $form->getData('conf_login');
     $user = jAuth::getUser($login);
     if (!$user) {
         $form->setErrorOn('conf_login', jLocale::get('password.form.confirm.login.doesnt.exist'));
         return $rep;
     }
     if ($user->status != JCOMMUNITY_STATUS_PWD_CHANGED) {
         jForms::destroy('confirmation');
         $rep = $this->getResponse('html');
         $tpl = new jTpl();
         $tpl->assign('status', JCOMMUNITY_STATUS_VALID);
         $rep->body->assign('MAIN', $tpl->fetch('password_ok'));
         return $rep;
     }
     if (strcmp($user->request_date, date('Y-m-d H:i:s', time() - 48 * 60 * 60)) < 0) {
         jForms::destroy('confirmation');
         $rep = $this->getResponse('html');
         $tpl = new jTpl();
         $tpl->assign('status', JCOMMUNITY_STATUS_MAIL_CHANGED);
         $rep->body->assign('MAIN', $tpl->fetch('password_ok'));
         return $rep;
     }
     if ($form->getData('conf_key') != $user->keyactivate) {
         $form->setErrorOn('conf_key', jLocale::get('password.form.confirm.bad.key'));
         return $rep;
     }
     $passwd = $form->getData('conf_password');
     $user->status = JCOMMUNITY_STATUS_VALID;
     jAuth::updateUser($user);
     jAuth::changePassword($login, $passwd);
     jAuth::login($login, $passwd);
     jForms::destroy('confirmation');
     $rep->action = "password:confirmok";
     return $rep;
 }
开发者ID:jelix,项目名称:jcommunity-module,代码行数:56,代码来源:password.classic.php

示例7: confirm

 /**
  * activate an account. the key should be given as a parameter
  */
 function confirm()
 {
     if (jAuth::isConnected()) {
         return $this->noaccess();
     }
     $rep = $this->getResponse("redirect");
     $rep->action = "registration:confirmform";
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
         return $rep;
     }
     $form = jForms::fill('confirmation');
     if ($form == null) {
         return $rep;
     }
     if (!$form->check()) {
         return $rep;
     }
     $login = $form->getData('conf_login');
     $user = jAuth::getUser($login);
     if (!$user) {
         $form->setErrorOn('conf_login', jLocale::get('register.form.confirm.login.doesnt.exist'));
         return $rep;
     }
     if ($user->status != JCOMMUNITY_STATUS_NEW) {
         jForms::destroy('confirmation');
         $rep = $this->getResponse('html');
         $tpl = new jTpl();
         $tpl->assign('already', true);
         $rep->body->assign('MAIN', $tpl->fetch('registration_ok'));
         return $rep;
     }
     if ($form->getData('conf_key') != $user->keyactivate) {
         $form->setErrorOn('conf_key', jLocale::get('register.form.confirm.bad.key'));
         return $rep;
     }
     $user->status = JCOMMUNITY_STATUS_VALID;
     jEvent::notify('jcommunity_registration_confirm', array('user' => $user));
     jAuth::updateUser($user);
     jAuth::changePassword($login, $form->getData('conf_password'));
     jAuth::login($login, $form->getData('conf_password'));
     jForms::destroy('confirmation');
     $rep->action = "registration:confirmok";
     return $rep;
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:47,代码来源:registration.classic.php

示例8: changePassword

 function changePassword()
 {
     $rep = $this->getResponse('json');
     //parametres
     $login = $this->param('login');
     $password = $this->param('password');
     //alert
     $this->success = false;
     $this->msg = "mot de passe non modifié";
     //verification
     if (!empty($login) && !empty($password)) {
         try {
             $this->success = jAuth::changePassword($login, $password);
         } catch (Exception $e) {
             $this->success = false;
             $this->msg = "mot de passe non modifié";
         }
         if ($this->success) {
             $this->msg = "mot de passe modifié ";
         }
     }
     $rep->data = array('success' => $this->success, 'msg' => $this->msg);
     return $rep;
 }
开发者ID:aurellemeless,项目名称:favoris,代码行数:24,代码来源:user.classic.php

示例9: savenewpwd

 /**
  * let's change the user password
  */
 function savenewpwd()
 {
     $login = $this->param('user');
     $rep = $this->getResponse('redirect');
     $rep->action = 'jcommunity~account:show';
     $rep->params = array('user' => $login);
     if ($login == '' || !jAuth::isConnected() || jAuth::getUserSession()->login != $login) {
         return $rep;
     }
     $form = jForms::fill('havefnubb~pwd', $login);
     if (!$form) {
         return $rep;
     }
     // check the form !
     $form->check();
     //if error go back to the form to retry to change the password
     if (count($form->getErrors())) {
         $rep->action = 'havefnubb~members:changepwd';
         // check if the new password is different from the actual one
     } else {
         if ($form->getData('conf_password') == $form->getData('old_password')) {
             jMessage::add(jLocale::get('havefnubb~members.pwd.passwd.are.the.same.unchanged'), 'warning');
             $rep->action = 'havefnubb~members:changepwd';
             return $rep;
         }
         //update the password
         $passwd = $form->getData('conf_password');
         $user = jAuth::getUser($login);
         // update the user info
         jAuth::updateUser($user);
         // change the pass
         jAuth::changePassword($login, $passwd);
         // login back with new pass
         jAuth::login($login, $passwd);
         jForms::destroy('havefnubb~pwd');
     }
     jMessage::add(jLocale::get('havefnubb~member.pwd.passwd.successfully.changed'), 'ok');
     return $rep;
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:42,代码来源:members.classic.php

示例10: activePassword

 function activePassword()
 {
     $rep = $this->getResponse('html');
     $rep->title = "Réiniatliser mot de passe étape 2/2 " . $rep->appName;
     $success = false;
     $expired = 0;
     $captchaSuccess = false;
     $msg = "Echec de l'operation : lien expir&eacute; ";
     $rep->bodyTpl = "activepassmessage";
     $token = $this->param('token');
     $password = $this->param('password');
     // security
     $recaptcha = $this->param("g-recaptcha-response");
     if (empty($recaptcha)) {
         $success = false;
         $captchaSuccess = false;
         $msg = " Vueillez cocher la case je ne suis pas un robot et respecter les instructions";
     } else {
         $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . $this->secretkey . "&response=" . $recaptcha . "&remoteip=" . $_SERVER['REMOTE_ADDR']);
         if ($response . success == false) {
             $captchaSuccess = false;
             $msg = "Donn&eacute;es invalides :  Vueillez cocher la case je ne suis pas un robot et respecter les instructions";
         } else {
             $captchaSuccess = true;
         }
     }
     // end security
     if (!empty($token) && $captchaSuccess && !empty($password)) {
         $pass = $password;
         $tb = jDao::get('user');
         $user = $tb->getByKeyactivate($token);
         // $sub->status=1;
         if ($user->id) {
             try {
                 $user->keyactivate = '111';
                 jAuth::updateUser($user);
                 jAuth::changePassword($user->login, $pass);
                 //mail
                 $mail = new jMailer();
                 $tpl = $mail->Tpl('user~activepassmail', false);
                 $tpl->assign('user', $user);
                 $tpl->assign('pass', $pass);
                 $mail->Send();
                 $success = true;
                 $expired = 0;
                 $msg = "Op&eacute;ration effectu&eacute;e avec succ&egrave;s : mot de passe" . " r&eacute;initialis&eacute; veuillez consulter votre mail, " . " pour connaitre votre nouveau mot de passe.";
             } catch (Exception $e) {
                 $success = false;
                 $expired = 1;
                 $msg = "Op&eacute;ration effectu&eacute;e echou&eacute;e:" . "formulaire invalide, votre lien d'activation est peut etre périmé;.";
             }
         } else {
             $expired = 1;
         }
     }
     $rep->body->assign('MESSAGE', $msg);
     $rep->body->assign('captchaSuccess', $captchaSuccess);
     $rep->body->assign('success', $success);
     $rep->body->assign('expired', $expired);
     $rep->body->assign('token', $token);
     $rep->body->assign('sitekey', $this->sitekey);
     return $rep;
 }
开发者ID:aurellemeless,项目名称:favoris,代码行数:63,代码来源:default.classic.php


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