diff --git a/~dev_rating/application/classes/Controller/Handler/Sign.php b/~dev_rating/application/classes/Controller/Handler/Sign.php index 29a30e4b392c625515594fde145fb8cec896a4ad..d8224793672eca4fe424b41d723b4be68bea4944 100644 --- a/~dev_rating/application/classes/Controller/Handler/Sign.php +++ b/~dev_rating/application/classes/Controller/Handler/Sign.php @@ -127,14 +127,17 @@ class Controller_Handler_Sign extends Controller_Handler $this->fail(); } - if (Model_Account::changeEMail($id, $email)) { - $session = Session::instance(); - $session->set('EMail', $email); - } else { - Log::instance()->add(Log::WARNING, '{0} {1}', array( - '{0}' => 'EMAIL_SIGNIN', - '{1}' => 'Cannot set email ' . $email . ' for user ' . $globalKey . ' ( ' . $id . ' )', - )); + $session = Session::instance(); + if ($session['EMail'] != $email) { + if (Model_Account::changeEMail($id, $email)) { + $session->set('EMail', $email); + $session->set('EMailChanged', true); + } else { + Log::instance()->add(Log::WARNING, '{0} {1}', array( + '{0}' => 'EMAIL_SIGNIN', + '{1}' => 'Cannot set email ' . $email . ' for user ' . $globalKey . ' ( ' . $id . ' )', + )); + } } $this->redirect('/'); diff --git a/~dev_rating/application/classes/Controller/Student/Index.php b/~dev_rating/application/classes/Controller/Student/Index.php index 1a620bc03ff3d630e5b957e98103ec6a23c53f3c..b082419c2f656a03df0a4024d03a60496f3f5fbd 100644 --- a/~dev_rating/application/classes/Controller/Student/Index.php +++ b/~dev_rating/application/classes/Controller/Student/Index.php @@ -20,10 +20,15 @@ class Controller_Student_Index extends Controller_Environment_Student $list = Controller_Teacher_Index::getShortListOfTeachers($list); } + $session = Session::instance(); + $EMailChanged = $session['EMailChanged']; + $session->set('EMailChanged', false); + $this->twig->set([ 'Marks' => $marks, 'Disciplines' => $disciplines, 'Teachers' => $teachers, + 'EMailChanged' => $EMailChanged, ])->set_filename(static::TWIG_FOLDER . 'index'); } diff --git a/~dev_rating/application/classes/Controller/Teacher/Index.php b/~dev_rating/application/classes/Controller/Teacher/Index.php index 7b4dd7140658adcefd4f48078d09597769e240ac..e32d08315e0f1956735a85e9baca54f706e41ea9 100644 --- a/~dev_rating/application/classes/Controller/Teacher/Index.php +++ b/~dev_rating/application/classes/Controller/Teacher/Index.php @@ -43,12 +43,17 @@ class Controller_Teacher_Index extends Controller_Environment_Teacher } } + $session = Session::instance(); + $EMailChanged = $session['EMailChanged']; + $session->set('EMailChanged', false); + $this->twig->set([ 'Subjects' => $subjects, 'Teachers' => $teachers, 'Groups' => $groups, 'Students' => $students, 'DisciplineCreationISAllowed' => Model_System::loadConfig()->Functional->DisciplineCreation, + 'EMailChanged' => $EMailChanged, ])->set_filename('teacher/index'); } diff --git a/~dev_rating/application/classes/User.php b/~dev_rating/application/classes/User.php index c14f6ab825f7ba2892bcf0787cf404a41bbebf69..7b96595ee011f06695c963ee99e7aa0e571caaf1 100644 --- a/~dev_rating/application/classes/User.php +++ b/~dev_rating/application/classes/User.php @@ -194,7 +194,8 @@ class User implements ArrayAccess $session->set('PasswordHash', $passwordHash); $session->set('start_time', time()); $session->set('RecordBookID', null); - + $session->set('EMailChanged', false); + foreach ($userInfo as $key => $value) $session->set($key, $value); diff --git a/~dev_rating/application/views/student/index.twig b/~dev_rating/application/views/student/index.twig index 68edf3216405ac5ec4cf1b9a527684dd45dc7393..35cd6ce4aea9d4584eea050e2aaf7ced4db3f017 100644 --- a/~dev_rating/application/views/student/index.twig +++ b/~dev_rating/application/views/student/index.twig @@ -59,6 +59,12 @@ {{ HTML.script('static/js/student/index.js')|raw }} <meta name="viewport" content="width=device-width, initial-scale=1.0"> + + {% if EMailChanged %} + <script> + alert('E-Mail быз изменен'); + </script> + {% endif %} {% endblock %} {% block main_content_classes %}sidePadding{% endblock %} diff --git a/~dev_rating/application/views/teacher/index.twig b/~dev_rating/application/views/teacher/index.twig index 9db4345fcbbe768d74f12301bc0610f4da99e8e2..2df525f01a64b5a6a9607a3913b2e92beed96352 100644 --- a/~dev_rating/application/views/teacher/index.twig +++ b/~dev_rating/application/views/teacher/index.twig @@ -5,6 +5,12 @@ {{ HTML.script('static/js/discipline/disciplineList.js')|raw }} {{ HTML.style('static/css/teacher/index.css')|raw }} {{ HTML.style('static/css/common/buttons.css')|raw }} + + {% if EMailChanged %} + <script> + alert('E-Mail быз изменен'); + </script> + {% endif %} {% endblock %} {% macro outputDiscipline(Discipline, Groups, Teachers, Students, DisciplineCreationISAllowed) %}