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

AMBARI-14963. Cannot login due to a JS error (alexantonenko)

Alex Antonenko пре 9 година
родитељ
комит
d9faf7412c
1 измењених фајлова са 10 додато и 1 уклоњено
  1. 10 1
      ambari-web/app/router.js

+ 10 - 1
ambari-web/app/router.js

@@ -349,9 +349,18 @@ App.Router = Em.Router.extend({
   /**
   /**
    * success callback of router.login.message
    * success callback of router.login.message
    * @param {object} data
    * @param {object} data
+   * @param {object} opt
+   * @param {object} params
    */
    */
   showLoginMessage: function (data, opt, params){
   showLoginMessage: function (data, opt, params){
-    var response = JSON.parse(data.Settings.content.replace(/\n/g, "\\n")),
+    try {
+      var response = JSON.parse(data.Settings.content.replace(/\n/g, "\\n"))
+    } catch (e) {
+      this.setClusterData(data, opt, params);
+      return false;
+    }
+
+    var
       text = response.text ? response.text : "",
       text = response.text ? response.text : "",
       buttonText = response.button ? response.button : Em.I18n.t('ok'),
       buttonText = response.button ? response.button : Em.I18n.t('ok'),
       status = response.status && response.status == "true" ? true : false,
       status = response.status && response.status == "true" ? true : false,