public function validatePassword($attribute) { if (!$this->hasErrors()) { $user = $this->getUser(); if (!$user || !$user->validatePassword($this->password)) { $this->addError($attribute, \admin\Module::t('model_loginform_wrong_user_or_password')); } } }
public function ngRestConfig($config) { $config->aw->register(new \admin\aws\GroupAuth(), Module::t('model_group_btn_aws_groupauth')); $config->delete = true; $config->list->field('name', Module::t('model_group_name'))->text(); $config->list->field('text', Module::t('model_group_description'))->textarea(); $config->create->copyFrom('list', ['id']); $config->create->extraField('users', Module::t('model_group_user_buttons'))->checkboxRelation(\admin\models\User::className(), 'admin_user_group', 'group_id', 'user_id', ['firstname', 'lastname', 'email'], '%s %s (%s)'); $config->update->copyFrom('create'); return $config; }
public function callbackSave($newpass, $newpasswd) { $model = new \admin\models\User(); $user = $model->findOne($this->getItemId()); $user->scenario = 'changepassword'; if ($user->changePassword($newpass, $newpasswd)) { return $this->response(true, ['message' => Module::t('aws_changepassword_succes')]); } else { return $this->response(false, $user->getFirstErrors()); } }
public function callbackSave($newpass, $newpasswd) { $object = Yii::createObject($this->className); if (!$object instanceof ChangePasswordInterface) { throw new Exception('The password change class must be instance of ChangePasswordInterface'); } $model = $object->findOne($this->getItemId()); if ($model) { if ($model->changePassword($newpass, $newpasswd)) { return $this->sendSuccess(Module::t('aws_changepassword_succes')); } return $this->sendError($model->getFirstErrors()); } return $this->sendError('Global Error'); }
public function __construct($class, $valueField, $labelField, $initValue = null) { $this->data[] = ['value' => null, 'label' => \admin\Module::t('ngrest_select_no_selection')]; $this->data[] = ['value' => null, 'label' => "- - - - - - - - - - - - - - - -"]; if (is_object($class)) { $class = $class::className(); } $this->initValue = $initValue; foreach ($class::find()->all() as $item) { $label = $item->{$labelField}; if (is_array($label)) { $label = reset($label); } $this->data[] = ['value' => (int) $item->{$valueField}, 'label' => $label]; } }
<div class="input input--text input--vertical col s6"> <label for="newpasswd" class="input__label"><?php echo \admin\Module::t('aws_changepassword_new_pass_retry'); ?> </label> <div class="input__field-wrapper"> <input id="newpasswd" type="password" ng-model="newpasswd" class="validate input__field"> </div> </div> </div> <div class="row"> <div class="col s12"> <button class="btn" ng-click="submit()" type="button"><?php echo \admin\Module::t('button_save'); ?> </button> </div> </div> <div class="row" ng-show="submitted && error"> <div class="alert alert--danger" > <ul> <li ng-repeat="msg in errorMessage">{{msg | json }}</li> </ul> </div> </div> <div class="row" ng-show="submitted && !error"> <div class="alert alert--success">{{ transport }}</div>
/** * <URL>/admin/api-admin-storage/files-upload. * * @todo change post_max_size = 20M * @todo change upload_max_filesize = 20M * @todo http://php.net/manual/en/features.file-upload.errors.php * * @return array|json Key represents the uploaded file name, value represents the id in the database. */ public function actionFilesUpload() { foreach ($_FILES as $k => $file) { if ($file['error'] !== UPLOAD_ERR_OK) { return ['upload' => false, 'message' => $this->_uploaderErrors[$file['error']]]; } try { Yii::$app->storage->addFile($file['tmp_name'], $file['name'], Yii::$app->request->post('folderId', 0)); return ['upload' => true, 'message' => Module::t('api_storage_file_upload_succes')]; } catch (Exception $err) { return ['upload' => false, 'message' => Module::t('api_sotrage_file_upload_error', ['error' => $err->getMessage()])]; } } return ['upload' => false, 'message' => Module::t('api_sotrage_file_upload_empty_error')]; }
<div style="padding:50px; margin:50px; text-align:center; background-color:#F0F0F0;"> <h1><?php echo \admin\Module::t('dashboard_title'); ?> </h1> <p><?php echo \admin\Module::t('dashboard_text'); ?> </p> </div>
</button> </div></div></div></div></form> <?php } ?> </div><div class="card-panel" ng-show="crudSwitchType==2" zaa-esc="closeUpdate()"> <?php if ($canUpdate && $config->getPointer('update')) { ?> <form name="formUpdate" role="form" ng-submit="submitUpdate()"> <div class="modal__content"> <?php foreach ($config->getPointer('update') as $k => $item) { ?> <div class="row"> <?php foreach ($this->context->createElements($item, \admin\ngrest\render\RenderCrud::TYPE_UPDATE) as $element) { ?> <?php echo $element['html']; ?> <?php } ?> </div><?php } ?> <div class="red lighten-2" style="color:white;" ng-show="updateErrors.length"> <ul> <li ng-repeat="error in updateErrors" style="padding:6px;">-{{error.message}}</li></ul> </div></div><div class="modal__footer"> <div class="row"> <div class="col s12"> <div class="right"> <button class="btn waves-effect waves-light" type="submit" ng-disabled="updateForm.$invalid"> <?php echo \admin\Module::t('button_save'); ?> <i class="material-icons right">check</i> </button> <button class="btn waves-effect waves-light red" type="button" ng-click="closeUpdate()"> <i class="material-icons left">cancel</i> <?php echo \admin\Module::t('button_abort'); ?> </button> </div></div></div></div></form> <?php } ?> </div></div><div ng-show="activeWindowModal" class="modal__wrapper" zaa-esc="closeActiveWindow()"> <div class="modal"> <button class="btn waves-effect waves-light modal__close btn-floating red" type="button" ng-click="closeActiveWindow()"> <i class="material-icons">close</i> </button> <div class="modal-content" compile-html ng-bind-html="data.aw.content"></div></div><div class="modal__background"></div></div></div>
<div ng-controller="ActiveWindowGalleryController"> <div class="col s8"> <storage-file-manager selection="true" only-images="true" /> </div> <div class="col s4" style="background-color:#F0F0F0;"> <div style="padding:10px;"> <h5><?php echo \admin\Module::t('aws_gallery_images'); ?> </h5> <div ng-show="isEmptyObject(files)"> <p><?php echo \admin\Module::t('aws_gallery_empty'); ?> </p> </div> <div class="col s3" ng-repeat="file in files" style="min-height:180px;"> <button type="button" ng-click="remove(file)" class="btn btn-flat"><i class="material-icons">delete</i></button> <img ng-src="{{file.source}}" height="150" class="responsive-img" /> </div> </div> </div> </div>