Преглед изворни кода

Fix access to course by password

Angel Fernando Quiroz Campos пре 6 година
родитељ
комит
94eafcf71f
1 измењених фајлова са 5 додато и 6 уклоњено
  1. 5 6
      main/auth/set_temp_password.php

+ 5 - 6
main/auth/set_temp_password.php

@@ -24,8 +24,6 @@ if (empty($course_id)) {
 
 $course_info = api_get_course_info_by_id($course_id);
 
-$tpl = new Template(null);
-
 // Build the form
 $form = new FormValidator(
     'set_temp_password',
@@ -45,11 +43,12 @@ if ($form->validate()) {
         header('Location: '.api_get_course_url($course_info['code'], $session_id));
         exit;
     } else {
-        $tpl->assign('error_message', Display::return_message(get_lang('CourseRegistrationCodeIncorrect'), 'error', true));
+        Display::addFlash(
+            Display::return_message(get_lang('CourseRegistrationCodeIncorrect'), 'error')
+        );
     }
 }
 
-$tpl->assign('form', $form->toHtml());
-$content = $tpl->get_template('auth/set_temp_password.tpl');
-$tpl->assign('content', $tpl->fetch($content));
+$tpl = new Template(null);
+$tpl->assign('content', $form->toHtml());
 $tpl->display_one_col_template();