PHP8
[Pman.BAdmin] / Pman.Dialog.BAdminPasswordReset.js
index 7698f26..d161d3d 100644 (file)
@@ -10,6 +10,7 @@ Roo.apply(Pman.Dialog.BAdminPasswordReset.prototype, {
  _strings : {
   'acd43bedab51b6704bf10d9ac136a032' :"Reset management password",
   '10ac3d04253ef7e1ddc73e6091c0cd55' :"Next",
+  'ea4788705e6873b424c65e91c2846b19' :"Cancel",
   'bbddd6ba0948d79e55486e615a265b56' :"Enter your new password",
   'c4ca4238a0b923820dcc509a6f75849b' :"1",
   '6d70a993714d2699e1d30e03d2753850' :"Please enter again to confirm"
@@ -17,6 +18,7 @@ Roo.apply(Pman.Dialog.BAdminPasswordReset.prototype, {
  _named_strings : {
   'ResetPassword_value' : 'c4ca4238a0b923820dcc509a6f75849b' /* 1 */ ,
   'ok_html' : '10ac3d04253ef7e1ddc73e6091c0cd55' /* Next */ ,
+  'cancel_html' : 'ea4788705e6873b424c65e91c2846b19' /* Cancel */ ,
   'password2_fieldLabel' : '6d70a993714d2699e1d30e03d2753850' /* Please enter again to confirm */ ,
   'password1_fieldLabel' : 'bbddd6ba0948d79e55486e615a265b56' /* Enter your new password */ 
  },
@@ -46,6 +48,7 @@ Roo.apply(Pman.Dialog.BAdminPasswordReset.prototype, {
   var _this = this;
   this.dialog = Roo.factory({
     xtype : 'Modal',
+    allow_close : false,
     animate : false,
     buttonPosition : 'center',
     cls : 'enable-overflow roo-bootstrap-dialog',
@@ -54,12 +57,27 @@ Roo.apply(Pman.Dialog.BAdminPasswordReset.prototype, {
      show : function (_self)
       {
           _this.dialog.el.select('.modal-content', true).first().unmask();
-          _this.form.findField('password1').focus();
+          var p1 =     _this.form.findField('password1');
+          p1.focus.defer(100, p1);
       }
     },
     xns : Roo.bootstrap,
     '|xns' : 'Roo.bootstrap',
     buttons : [
+     {
+      xtype : 'Button',
+      html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
+      name : 'cancel',
+      weight : 'default',
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.callback.call(_this, false);
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     },
      {
       xtype : 'Button',
       html : _this._strings['10ac3d04253ef7e1ddc73e6091c0cd55'] /* Next */,
@@ -94,13 +112,13 @@ Roo.apply(Pman.Dialog.BAdminPasswordReset.prototype, {
           loadMask : false,
           method : 'POST',
           style : 'padding: 10px;',
-          url : baseURL + '/Login/ResetPassword',
+          url : baseURL + '/Login',
           verifyCheckSum : function() 
           { 
               _this.dialog.hide();
               
               new Pman.Request({
-                  url: baseURL + '/Login.php',
+                  url: baseURL + '/Login',
                   method : 'POST',
                   mask : 'Verifying...',
                   params : {
@@ -111,6 +129,14 @@ Roo.apply(Pman.Dialog.BAdminPasswordReset.prototype, {
                   },
                   success : function(res) {
                       _this.dialog.show();
+                  },
+                  failure : function(res)
+                  {
+                      Roo.log(res);
+                      Roo.MessageBox.alert("Sorry", res.message, function() {
+                          _this.callback(false,false);
+                      });
+                      
                   }
               });
           },
@@ -129,7 +155,7 @@ Roo.apply(Pman.Dialog.BAdminPasswordReset.prototype, {
                     
                     if(data.length != 3){
                         _this.dialog.hide();
-                        Roo.bootstrap.MessageBox.alert('Error', 'Account reset link is not correct - please try again or paste the link correctly');
+                        Roo.bootstrap.MessageBox.alert('Sorry', 'Account reset link is not correct - please try again or paste the link correctly');
                         return;
                     }
                     
@@ -150,12 +176,18 @@ Roo.apply(Pman.Dialog.BAdminPasswordReset.prototype, {
                 if (action.type =='submit') {
                     
                     _this.dialog.hide();
+                    _this.form.reset();        
+                    Roo.MessageBox.alert("Great", "We have successfully updated your password, please use it to login now",
+                       function() {
+                            if (_this.callback) {
+                                _this.callback.call(_this, action.result);
+                            }
+                            
+                        }
+                    );
                     
-                    if (_this.callback) {
-                        _this.callback.call(_this, action.result);
-                    }
                     
-                    _this.form.reset();
+            
                     
                     return;