forked from instantsoft/icms2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Возможность выводить дату изменения записей ТК в админке; Возможность отключать восстановление паролей; Fix Open Redirect; close instantsoft#1497 close instantsoft#1495 Cropper обновлён до актуальной версии; Jquery Inputmask обновлён до актуальной версии; VueJS обновлён до актуальной версии; Мелкий рефакторинг.
- Loading branch information
Showing
132 changed files
with
679 additions
and
547 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,80 @@ | ||
<?php | ||
/** | ||
* @property \modelUsers $model_users | ||
*/ | ||
class actionAuthReset extends cmsAction { | ||
|
||
public function run($pass_token){ | ||
public function run($pass_token) { | ||
|
||
if ($this->cms_user->is_logged && !$this->cms_user->is_admin) { $this->redirectToHome(); } | ||
|
||
if (!$pass_token) { cmsCore::error404(); } | ||
if (!empty($this->options['disable_restore'])) { | ||
return cmsCore::error404(); | ||
} | ||
|
||
$users_model = cmsCore::getModel('users'); | ||
if ($this->cms_user->is_logged && !$this->cms_user->is_admin) { | ||
return$this->redirectToHome(); | ||
} | ||
|
||
$profile = $users_model->getUserByPassToken($pass_token); | ||
if (!$profile) { cmsCore::error404(); } | ||
if (!$pass_token) { | ||
return cmsCore::error404(); | ||
} | ||
|
||
if($profile['is_locked']){ | ||
$profile = $this->model_users->getUserByPassToken($pass_token); | ||
if (!$profile) { | ||
return cmsCore::error404(); | ||
} | ||
|
||
cmsUser::addSessionMessage(LANG_RESTORE_BLOCK.($profile['lock_reason'] ? '. '.$profile['lock_reason'] : ''), 'error'); | ||
if ($profile['is_locked']) { | ||
|
||
$this->redirectToHome(); | ||
cmsUser::addSessionMessage(LANG_RESTORE_BLOCK . ($profile['lock_reason'] ? '. ' . $profile['lock_reason'] : ''), 'error'); | ||
|
||
return $this->redirectToHome(); | ||
} | ||
|
||
if ((strtotime($profile['date_token']) + (24 * 3600)) < time()){ | ||
if ((strtotime($profile['date_token']) + (24 * 3600)) < time()) { | ||
|
||
$users_model->clearUserPassToken($profile['id']); | ||
$this->model_users->clearUserPassToken($profile['id']); | ||
|
||
cmsUser::addSessionMessage(LANG_RESTORE_TOKEN_EXPIRED, 'error'); | ||
|
||
$this->redirectToAction('restore'); | ||
|
||
return $this->redirectToAction('restore'); | ||
} | ||
|
||
$form = $this->getForm('reset'); | ||
|
||
if ($this->request->has('submit')){ | ||
if ($this->request->has('submit')) { | ||
|
||
$_profile = $form->parse($this->request, true); | ||
|
||
$errors = $form->validate($this, $_profile); | ||
|
||
if (!$errors){ | ||
if (!$errors) { | ||
|
||
$result = $users_model->updateUser($profile['id'], $_profile); | ||
$result = $this->model_users->updateUser($profile['id'], $_profile); | ||
|
||
if ($result['success']){ | ||
if ($result['success']) { | ||
|
||
cmsUser::addSessionMessage(LANG_PASS_CHANGED, 'success'); | ||
|
||
$users_model->clearUserPassToken($profile['id']); | ||
$this->model_users->clearUserPassToken($profile['id']); | ||
|
||
$this->redirectTo('users', $profile['id']); | ||
return $this->redirectTo('users', $profile['id']); | ||
|
||
} else { | ||
|
||
$errors = $result['errors']; | ||
} | ||
|
||
} | ||
|
||
if ($errors){ | ||
if ($errors) { | ||
cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error'); | ||
} | ||
|
||
} | ||
|
||
return $this->cms_template->render('reset', array( | ||
return $this->cms_template->render('reset', [ | ||
'profile' => $profile, | ||
'form' => $form, | ||
'errors' => isset($errors) ? $errors : false | ||
)); | ||
|
||
]); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.