Skip to content
Snippets Groups Projects
Commit 770f78cb authored by Владислав Яковлев's avatar Владислав Яковлев
Browse files

FEAT: notify when email is changed

parent 944d9c13
Branches
No related merge requests found
......@@ -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('/');
......
......@@ -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');
}
......
......@@ -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');
}
......
......@@ -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);
......
......@@ -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 %}
......
......@@ -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) %}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment