Пример #1
0
 public function actionChangepassword($id)
 {
     $auth = Mindy::app()->auth;
     if ($auth->isGuest) {
         $this->r->redirect(Mindy::app()->homeUrl);
     }
     $model = User::objects()->filter(['pk' => $id])->get();
     if ($model === null) {
         $this->error(404);
     }
     $admin = new UserAdmin();
     $this->addBreadcrumb(Text::mbUcfirst($admin->getVerboseName()), Mindy::app()->urlManager->reverse('admin:list', ['module' => User::getModuleName(), 'adminClass' => $admin->classNameShort()]));
     $this->addBreadcrumb((string) $model, Mindy::app()->urlManager->reverse('admin:update', ['module' => User::getModuleName(), 'adminClass' => $admin->classNameShort(), 'id' => $id]));
     $this->addBreadcrumb(UserModule::t('Change password'));
     $form = new ChangePasswordForm(['model' => $model]);
     if ($this->r->isPost && $form->populate($_POST)->isValid() && $form->save()) {
         $this->r->flash->success(UserModule::t('Password changed'));
         $this->r->http->refresh();
     }
     echo $this->render('admin/changepassword.html', ['model' => $model, 'form' => $form]);
 }