defined('MOBICMS') or die('Error: restricted access'); use Config\System as Config; $app = App::getInstance(); $user = $app->user()->get(); $form = new Mobicms\Form\Form(['action' => $app->request()->getUri()]); if ($user->rights >= 7 || $user->nickChanged < time() - Config::$usrChangeNicknamePeriod * 86400) { $form->title(_m('Change Nickname'))->element('text', 'nickname', ['label' => _m('New Nickname'), 'maxlength' => 20, 'required' => true])->element('text', 'repeat', ['label' => _m('Repeat Nickname'), 'maxlength' => 20, 'description' => _s('Min. 2, Max. 20 Characters.<br>Allowed letters are Cyrillic and Latin alphabet, numbers, spaces and punctuation - = @ ! ? ~ . _ ( ) [ ] *') . '<br/>' . _m('Please note that while changing the nickname is changing your Login on the site.<br>The next change of nickname is allowed through') . ' ' . Config::$usrChangeNicknamePeriod . ' ' . _sp('Day', 'Days', Config::$usrChangeNicknamePeriod) . '.', 'required' => true])->element('password', 'password', ['label' => _m('Your Password'), 'required' => true])->divider()->element('submit', 'submit', ['value' => _s('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>')->validate('nickname', 'lenght', ['min' => 2, 'max' => 20])->validate('repeat', 'compare', ['compare_field' => 'nickname']); } else { $form->html('<div class="alert alert-danger">' . '<strong>' . _m('Nickname can not change more than once a') . ' ' . Config::$usrChangeNicknamePeriod . ' ' . _sp('Day', 'Days', Config::$usrChangeNicknamePeriod) . '</strong><br/><br/>' . _m('You have already changed their nickname:') . ' ' . Includes\Functions::displayDate($user->nickChanged) . '<br/>' . _m('Next time will be able to change:') . ' ' . Includes\Functions::displayDate($user->nickChanged + Config::$usrChangeNicknamePeriod * 86400) . '</div>')->html('<a class="btn btn-primary" href="../">' . _s('Back') . '</a>'); } if ($form->process() === true) { $valid = $app->user()->validate(); // Проверяем Ник if (!$valid->checkNicknameChars($form->output['nickname'])) { // Обнаружены запрещенные символы $form->setError('nickname', _s('Invalid characters')); } elseif (!$valid->checkNicknameCharsets($form->output['nickname'])) { // Обнаружены символы из разных языков $form->setError('nickname', _s('It is forbidden to use characters of different languages')); } elseif (ctype_digit($form->output['nickname']) && !Config::$usrNicknameDigitsOnly) { // Ник состоит только из цифр $form->setError('nickname', _s('Nicknames consisting only of numbers are prohibited')); } elseif (!$valid->checkNicknameRepeatedChars($form->output['nickname'])) { // Обнаружены повторяющиеся символыь (более 3-х подряд) $form->setError('nickname', _s('Repeated characters')); } elseif (filter_var($form->output['nickname'], FILTER_VALIDATE_EMAIL)) { // Попытка использовать Email адрес в качестве Ника $form->setError('nickname', _s('Email cannot be used as the Nickname')); } elseif ($valid->checkNicknameExists($form->output['nickname'])) { // Ник уже занят $form->setError('nickname', _s('This Nickname is already taken'));
* @license LICENSE.md (see attached file) */ defined('MOBICMS') or die('Error: restricted access'); $app = App::getInstance(); $user = $app->user()->get(); $profile = $app->profile(); if ($user->rights == 9 || $user->rights == 7 && $user->rights > $profile->rights) { $items = [0 => _m('User'), 3 => _m('Forum Moderator'), 4 => _m('Downloads Moderator'), 5 => _m('Library Moderator'), 6 => _m('Super Modererator')]; if ($user->rights == 9) { $items['7'] = '<i class="exclamation-circle lg"></i> ' . _m('Administrator'); $items['9'] = '<span class="danger"><i class="exclamation-circle lg"></i> ' . _m('Supervisor') . '</span>'; } $form = new Mobicms\Form\Form(['action' => $app->request()->getUri()]); $form->title(_m('Rank'))->element('radio', 'rights', ['checked' => $profile->rights, 'items' => $items])->element('password', 'password', ['label' => _m('Your Password'), 'required' => true])->divider()->element('submit', 'submit', ['value' => _s('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>'); if ($form->process() === true) { // Проверяем пароль if (!$user->checkPassword($form->output['password'])) { $form->setError('password', _s('Invalid password')); } if ($form->isValid) { $profile->offsetSet('rights', intval($form->output['rights']), true); $profile->save(); if ($profile->id == $user->id) { $app->redirect('../'); } } } $app->view()->admin = true; $app->view()->form = $form->display(); $app->view()->setTemplate('edit_form.php'); }
defined('MOBICMS') or die('Error: restricted access'); use Config\System as Config; $user = App::user()->get(); $form = new Mobicms\Form\Form(['action' => App::request()->getUri()]); if ($user->rights >= 7 || $user->change_time < time() - Config::$usrChangeNicknamePeriod * 86400) { $form->title(_dg('Change Nickname'))->element('text', 'nickname', ['label' => _dg('New Nickname'), 'maxlength' => 20, 'required' => true])->element('text', 'repeat', ['label' => _dg('Repeat Nickname'), 'maxlength' => 20, 'description' => _g('Min. 2, Max. 20 Characters.<br>Allowed letters are Cyrillic and Latin alphabet, numbers, spaces and punctuation - = @ ! ? ~ . _ ( ) [ ] *') . '<br/>' . _dg('Please note that while changing the nickname is changing your Login on the site.<br>The next change of nickname is allowed through') . ' ' . Config::$usrChangeNicknamePeriod . ' ' . _n('Day', 'Days', Config::$usrChangeNicknamePeriod) . '.', 'required' => true])->element('password', 'password', ['label' => _dg('Your Password'), 'required' => true])->divider()->element('submit', 'submit', ['value' => _g('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _g('Back') . '</a>')->validate('nickname', 'lenght', ['min' => 2, 'max' => 20])->validate('repeat', 'compare', ['compare_field' => 'nickname']); } else { $form->html('<div class="alert alert-danger">' . '<strong>' . _dg('Nickname can not change more than once a') . ' ' . Config::$usrChangeNicknamePeriod . ' ' . _n('Day', 'Days', Config::$usrChangeNicknamePeriod) . '</strong><br/><br/>' . _dg('You have already changed their nickname:') . ' ' . Includes\Functions::displayDate($user->change_time) . '<br/>' . _dg('Next time will be able to change:') . ' ' . Includes\Functions::displayDate($user->change_time + Config::$usrChangeNicknamePeriod * 86400) . '</div>')->html('<a class="btn btn-primary" href="../">' . _g('Back') . '</a>'); } if ($form->process() === true) { try { // Проверяем ник App::user()->validate()->checkNickname($form->output['nickname']); // Проверяем пароль if (!$user->checkPassword($form->output['password'])) { $form->setError('password', _g('Invalid password')); } } catch (Mobicms\Checkpoint\Exceptions\UserExceptionInterface $e) { $form->setError('nickname', $e->getMessage()); } // Если все проверки пройдены, записываем данные if ($form->isValid) { $profile = App::profile(); $profile->nickname = $form->output['nickname']; $profile->change_time = time(); $profile->save(); $form->continueLink = '../'; $form->successMessage = _dg('Nickname successfully changed'); $form->confirmation = true; } }
* @copyright Copyright (C) mobiCMS Community * @license LICENSE.md (see attached file) */ defined('MOBICMS') or die('Error: restricted access'); $app = App::getInstance(); $profile = $app->profile(); $form = new Mobicms\Form\Form(['action' => $app->request()->getUri()]); $form->title(_m('Change E-mail')); if (!empty($profile->email)) { $form->element('text', 'oldemail', ['label' => _m('Old E-mail'), 'value' => $profile->email, 'readonly' => true]); } $form->element('text', 'email', ['label' => _m('New E-mail'), 'maxlength' => 50])->element('text', 'repeatemail', ['label' => _m('Repeat E-mail'), 'maxlength' => 50, 'description' => _m('Correctly specify your email address, that it will be sent your password.<br/>Max. 50 characters')])->element('password', 'password', ['label' => _m('Your Password'), 'required' => true])->divider()->element('submit', 'submit', ['value' => _s('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>')->validate('email', 'lenght', ['min' => 5, 'max' => 50, 'empty' => true])->validate('repeatemail', 'compare', ['compare_field' => 'email']); if ($form->process() === true) { // Проверяем Email if (!filter_var($form->output['email'], FILTER_VALIDATE_EMAIL)) { $form->setError('email', _s('Invalid Email address')); } elseif ($app->user()->validate()->checkEmailExists($form->output['email'])) { $form->setError('email', _s('This Email is already taken')); } // Проверяем пароль if (!$user->checkPassword($form->output['password'])) { $form->setError('password', _s('Invalid password')); } if ($form->isValid) { $profile->email = $form->output['email']; $profile->save(); $form->continueLink = '../'; $form->confirmation = true; } } $app->view()->form = $form->display();
* mobiCMS Content Management System (http://mobicms.net) * * For copyright and license information, please see the LICENSE.md * Installing the system or redistributions of files must retain the above copyright notice. * * @link http://mobicms.net mobiCMS Project * @copyright Copyright (C) mobiCMS Community * @license LICENSE.md (see attached file) */ defined('MOBICMS') or die('Error: restricted access'); $form = new Mobicms\Form\Form(['action' => App::request()->getUri()]); $form->element('text', 'login', ['label' => _g('Nickname or Email'), 'class' => 'relative largetext', 'required' => true])->element('password', 'password', ['label' => _g('Password'), 'class' => 'relative largetext', 'required' => true])->element('checkbox', 'remember', ['checked' => true, 'label_inline' => _g('Remember')])->divider(12)->element('submit', 'submit', ['value' => _g('Login'), 'class' => 'btn btn-primary btn-lg btn-block'])->html('<br/><a class="btn btn-default" href="#">' . _g('Forgot password?') . '</a>')->validate('login', 'lenght', ['min' => 2, 'max' => 20])->validate('password', 'lenght', ['min' => 3]); if ($form->process() === true) { try { App::user()->validate()->checkLogin($form->output['login']); try { App::user()->login($form->output['login'], $form->output['password'], $form->output['remember']); } catch (\Mobicms\Checkpoint\Exceptions\UserExceptionInterface $e) { $form->errorMessage = _g('Login information are incorrect'); $form->setError('login', ''); $form->setError('password', ''); } } catch (\Mobicms\Checkpoint\Exceptions\UserExceptionInterface $e) { $form->setError('login', $e->getMessage()); } if (App::user()->isValid()) { App::redirect(App::request()->getBaseUrl()); } } App::view()->form = $form->display(); App::view()->setTemplate('login.php');
<?php /* * mobiCMS Content Management System (http://mobicms.net) * * For copyright and license information, please see the LICENSE.md * Installing the system or redistributions of files must retain the above copyright notice. * * @link http://mobicms.net mobiCMS Project * @copyright Copyright (C) mobiCMS Community * @license LICENSE.md (see attached file) */ defined('MOBICMS') or die('Error: restricted access'); $form = new Mobicms\Form\Form(['action' => App::request()->getUri()]); $form->element('text', 'login', ['label' => _s('Nickname or Email'), 'class' => 'relative largetext', 'required' => true])->element('password', 'password', ['label' => _s('Password'), 'class' => 'relative largetext', 'required' => true])->element('checkbox', 'remember', ['checked' => true, 'label_inline' => _s('Remember')])->divider(12)->element('submit', 'submit', ['value' => _s('Login'), 'class' => 'btn btn-primary btn-lg btn-block'])->html('<br/><a class="btn btn-default" href="#">' . _s('Forgot password?') . '</a>')->validate('login', 'lenght', ['min' => 2, 'max' => 20])->validate('password', 'lenght', ['min' => 3]); if ($form->process() === true) { if (App::user()->validate()->checkNicknameChars($form->output['login']) && App::user()->validate()->checkNicknameCharsets($form->output['login'])) { try { App::user()->login($form->output['login'], $form->output['password'], $form->output['remember']); App::redirect(App::request()->getBaseUrl()); } catch (\Mobicms\Checkpoint\Exceptions\UserExceptionInterface $e) { $form->errorMessage = _s('Login information are incorrect'); $form->setError('login', ''); $form->setError('password', ''); } } else { $form->setError('login', _s('Invalid characters')); } } App::view()->form = $form->display(); App::view()->setTemplate('login.php');
* * For copyright and license information, please see the LICENSE.md * Installing the system or redistributions of files must retain the above copyright notice. * * @link http://mobicms.net mobiCMS Project * @copyright Copyright (C) mobiCMS Community * @license LICENSE.md (see attached file) */ defined('MOBICMS') or die('Error: restricted access'); $user = App::user()->get(); $profile = App::profile(); $form = new Mobicms\Form\Form(['action' => App::request()->getUri()]); $form->title(_dg('Change Password'))->element('password', 'oldpass', ['label' => $profile->id == $user->id ? _dg('Old Password') : _dg('Admin Password'), 'required' => true])->element('password', 'newpass', ['label' => _dg('New Password'), 'description' => _g('The password length min. 3 characters'), 'required' => true])->element('password', 'newconf', ['label' => _g('Repeat password'), 'required' => true])->divider()->element('submit', 'submit', ['value' => _g('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _g('Back') . '</a>')->validate('oldpass', 'lenght', ['continue' => false, 'min' => 3])->validate('newpass', 'lenght', ['continue' => false, 'min' => 3])->validate('newconf', 'compare', ['compare_field' => 'newpass', 'error' => _g("Passwords don't coincide")]); if ($form->process() === true) { if ($user->checkPassword($form->output['oldpass'])) { $profile->setPassword($form->output['newpass']); $profile->setToken(App::user()->generateToken()); $profile->save(); if ($profile->id == $user->id) { $remember = filter_has_var(INPUT_COOKIE, App::user()->domain); App::user()->login($user->nickname, $form->output['newpass'], $remember); } $form->continueLink = '../'; $form->successMessage = _dg('The password is successfully changed'); $form->confirmation = true; } else { $form->setError('oldpass', _g('Invalid password')); } } App::view()->form = $form->display(); App::view()->setTemplate('edit_form.php');