MDL-54551 core: touch-up after review

1. Reworded the string.
2. Removed logic handling form data.
3. Do not use window.location.replace.
This commit is contained in:
Mark Nelson
2018-07-18 17:52:34 +08:00
parent acf94de6d5
commit feb6a52035
3 changed files with 4 additions and 10 deletions

View File

@@ -25,7 +25,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since 2.9
*/
define(['jquery', 'core/config', 'core/log', 'core/yui', 'core/url'], function($, config, Log, Y, URL) {
define(['jquery', 'core/config', 'core/log', 'core/url'], function($, config, Log, URL) {
// Keeps track of when the user leaves the page so we know not to show an error.
var unloading = false;
@@ -81,13 +81,7 @@ define(['jquery', 'core/config', 'core/log', 'core/yui', 'core/url'], function($
if (exception !== null) {
// If the user isn't doing anything too important, redirect to the login page.
if (exception.errorcode === "servicerequireslogin") {
Y.use('moodle-core-formchangechecker', function() {
if (!M.core_formchangechecker.get_form_dirty_state()) {
// If we reach here, the user isn't editing anything on the page.
var loginUrl = URL.relativeUrl("/login/index.php");
window.location.replace(loginUrl);
}
});
window.location = URL.relativeUrl("/login/index.php");
} else {
for (; i < requests.length; i++) {
request = requests[i];