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


PHP BackendAuthentication::checkPassword方法代码示例

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


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

示例1: validateForm

 /**
  * Validate the form
  */
 private function validateForm()
 {
     // is the form submitted?
     if ($this->frm->isSubmitted()) {
         // cleanup the submitted fields, ignore fields that were added by hackers
         $this->frm->cleanupFields();
         // email is present
         if ($this->frm->getField('email')->isFilled(BL::err('EmailIsRequired'))) {
             // is this an email-address
             if ($this->frm->getField('email')->isEmail(BL::err('EmailIsInvalid'))) {
                 // was this emailaddress deleted before
                 if (BackendUsersModel::emailDeletedBefore($this->frm->getField('email')->getValue())) {
                     $this->frm->getField('email')->addError(sprintf(BL::err('EmailWasDeletedBefore'), BackendModel::createURLForAction('undo_delete', null, null, array('email' => $this->frm->getField('email')->getValue()))));
                 } else {
                     // email already exists
                     if (BackendUsersModel::existsEmail($this->frm->getField('email')->getValue())) {
                         $this->frm->getField('email')->addError(BL::err('EmailAlreadyExists'));
                     }
                 }
             }
         }
         // required fields
         $this->frm->getField('password')->isFilled(BL::err('PasswordIsRequired'));
         $this->frm->getField('nickname')->isFilled(BL::err('NicknameIsRequired'));
         $this->frm->getField('name')->isFilled(BL::err('NameIsRequired'));
         $this->frm->getField('surname')->isFilled(BL::err('SurnameIsRequired'));
         $this->frm->getField('interface_language')->isFilled(BL::err('FieldIsRequired'));
         $this->frm->getField('date_format')->isFilled(BL::err('FieldIsRequired'));
         $this->frm->getField('time_format')->isFilled(BL::err('FieldIsRequired'));
         $this->frm->getField('number_format')->isFilled(BL::err('FieldIsRequired'));
         $this->frm->getField('groups')->isFilled(BL::err('FieldIsRequired'));
         if ($this->frm->getField('password')->isFilled()) {
             if ($this->frm->getField('password')->getValue() !== $this->frm->getField('confirm_password')->getValue()) {
                 $this->frm->getField('confirm_password')->addError(BL::err('ValuesDontMatch'));
             }
         }
         // validate avatar
         if ($this->frm->getField('avatar')->isFilled()) {
             // correct extension
             if ($this->frm->getField('avatar')->isAllowedExtension(array('jpg', 'jpeg', 'gif', 'png'), BL::err('JPGGIFAndPNGOnly'))) {
                 // correct mimetype?
                 $this->frm->getField('avatar')->isAllowedMimeType(array('image/gif', 'image/jpg', 'image/jpeg', 'image/png'), BL::err('JPGGIFAndPNGOnly'));
             }
         }
         // no errors?
         if ($this->frm->isCorrect()) {
             // build settings-array
             $settings['nickname'] = $this->frm->getField('nickname')->getValue();
             $settings['name'] = $this->frm->getField('name')->getValue();
             $settings['surname'] = $this->frm->getField('surname')->getValue();
             $settings['interface_language'] = $this->frm->getField('interface_language')->getValue();
             $settings['date_format'] = $this->frm->getField('date_format')->getValue();
             $settings['time_format'] = $this->frm->getField('time_format')->getValue();
             $settings['datetime_format'] = $settings['date_format'] . ' ' . $settings['time_format'];
             $settings['number_format'] = $this->frm->getField('number_format')->getValue();
             $settings['csv_split_character'] = $this->frm->getField('csv_split_character')->getValue();
             $settings['csv_line_ending'] = $this->frm->getField('csv_line_ending')->getValue();
             $settings['password_key'] = uniqid();
             $settings['current_password_change'] = time();
             $settings['avatar'] = 'no-avatar.gif';
             $settings['api_access'] = (bool) $this->frm->getField('api_access')->getChecked();
             // get selected groups
             $groups = $this->frm->getField('groups')->getChecked();
             // init var
             $newSequence = BackendGroupsModel::getSetting($groups[0], 'dashboard_sequence');
             // loop through groups and collect all dashboard widget sequences
             foreach ($groups as $group) {
                 $sequences[] = BackendGroupsModel::getSetting($group, 'dashboard_sequence');
             }
             // loop through sequences
             foreach ($sequences as $sequence) {
                 // loop through modules inside a sequence
                 foreach ($sequence as $moduleKey => $module) {
                     // loop through widgets inside a module
                     foreach ($module as $widgetKey => $widget) {
                         // if widget present set true
                         if ($widget['present']) {
                             $newSequence[$moduleKey][$widgetKey]['present'] = true;
                         }
                     }
                 }
             }
             // add new sequence to settings
             $settings['dashboard_sequence'] = $newSequence;
             // build user-array
             $user['email'] = $this->frm->getField('email')->getValue();
             $user['password'] = BackendAuthentication::getEncryptedString($this->frm->getField('password')->getValue(true), $settings['password_key']);
             // save the password strength
             $passwordStrength = BackendAuthentication::checkPassword($this->frm->getField('password')->getValue(true));
             $settings['password_strength'] = $passwordStrength;
             // save changes
             $user['id'] = (int) BackendUsersModel::insert($user, $settings);
             // has the user submitted an avatar?
             if ($this->frm->getField('avatar')->isFilled()) {
                 // create new filename
                 $filename = rand(0, 3) . '_' . $user['id'] . '.' . $this->frm->getField('avatar')->getExtension();
                 // add into settings to update
//.........这里部分代码省略.........
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:101,代码来源:add.php


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