Pman.Dialog.BAdminPasswordReset.bjs
authorAlan Knowles <alan@roojs.com>
Fri, 7 Dec 2018 02:25:15 +0000 (10:25 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 7 Dec 2018 02:25:15 +0000 (10:25 +0800)
Pman.Dialog.BAdminPasswordReset.js

Pman.Dialog.BAdminPasswordReset.bjs
Pman.Dialog.BAdminPasswordReset.js [new file with mode: 0644]

index 6dd7515..6c766e5 100644 (file)
@@ -5,6 +5,133 @@
  "path" : "/home/alan/gitlive/Pman.BAdmin/Pman.Dialog.BAdminPasswordReset.bjs",
  "permname" : "",
  "modOrder" : "001",
+ "strings" : {
+  "10ac3d04253ef7e1ddc73e6091c0cd55" : "Next",
+  "bbddd6ba0948d79e55486e615a265b56" : "Enter your new password",
+  "c4ca4238a0b923820dcc509a6f75849b" : "1",
+  "6d70a993714d2699e1d30e03d2753850" : "Please enter again to confirm",
+  "6072e83b7f35887c76e64920bd370f4a" : "Reset Password"
+ },
+ "named_strings" : {
+  "ResetPassword_value" : "c4ca4238a0b923820dcc509a6f75849b",
+  "ok_html" : "10ac3d04253ef7e1ddc73e6091c0cd55",
+  "password2_fieldLabel" : "6d70a993714d2699e1d30e03d2753850",
+  "password1_fieldLabel" : "bbddd6ba0948d79e55486e615a265b56"
+ },
  "items" : [
+  {
+   "listeners" : {
+    "show" : "function (_self)\n{\n    _this.dialog.el.select('.modal-content', true).first().unmask();\n    \n}"
+   },
+   "String cls" : "enable-overflow roo-bootstrap-dialog",
+   "Boolean animate" : false,
+   "title" : "Reset Password",
+   "xtype" : "Modal",
+   "buttonPosition" : "center",
+   "$ xns" : "Roo.bootstrap",
+   "items" : [
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.dialog.el.select('.modal-content', true).first().mask('Sending...');\n    _this.form.doAction('submit');\n}"
+     },
+     "String weight" : "primary",
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "Next",
+     "* prop" : "buttons[]",
+     "string name" : "ok"
+    },
+    {
+     "xtype" : "Row",
+     "$ xns" : "Roo.bootstrap",
+     "items" : [
+      {
+       "xtype" : "Container",
+       "cls" : "col-md-12",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "listeners" : {
+          "|render" : "function (_self) {\n    _this.form = _self;\n}",
+          "|actionfailed" : "function (_self, action) {\n\n    Roo.log('action fail?');\n    Roo.log(action);\n    \n    _this.dialog.el.select('.modal-content', true).first().unmask();\n    \n    var err = 'Fill in all the required fields';\n    \n    if (typeof(action) != 'undefined' && action.failureType == 'server') {\n        err = action.result.errorMsg;\n    }\n    \n    Roo.bootstrap.MessageBox.alert('Error', err);\n}",
+          "|actioncomplete" : "function (_self, action) {\n\n    if (action.type == 'setdata') {\n        \n        var pathname = window.location.pathname.split('PasswordReset/');\n        \n        if(typeof(pathname[1]) == 'undefined'){\n            return;\n        }\n        \n        var data = pathname[1].split('/');\n        \n        if(data.length != 3){\n            _this.dialog.hide();\n            Roo.bootstrap.MessageBox.alert('Error', 'Account reset link is not correct - please try again or paste the link correctly');\n            return;\n        }\n        \n        _this.form.findField('id').setValue(data[0]);\n        _this.form.findField('ts').setValue(data[1]);\n        _this.form.findField('key').setValue(data[2]);\n    \n        _this.form.clearInvalid();\n    \n        _this.form.verifyCheckSum();\n        \n        return;\n    }\n    if (action.type == 'load') {\n         \n        return;\n    }\n    if (action.type =='submit') {\n        \n        _this.dialog.hide();\n        \n        if (_this.callback) {\n            _this.callback.call(_this, action.result);\n        }\n        \n        _this.form.reset();\n        \n        return;\n        \n    }\n}"
+         },
+         "$ url" : "baseURL + '/Login/ResetPassword'",
+         "labelAlign" : "top",
+         "xtype" : "Form",
+         "method" : "POST",
+         "| function verifyCheckSum" : "function() \n{ \n    _this.dialog.hide();\n    \n    new Pman.Request({\n        url: baseURL + '/Login.php',\n        method : 'POST',\n        mask : 'Verifying...',\n        params : {\n            id : _this.form.findField('id').getValue(),\n            ts : _this.form.findField('ts').getValue(),\n            key : _this.form.findField('key').getValue(),\n            _verifyCheckSum : 1\n        },\n        success : function(res) {\n            _this.dialog.show();\n        }\n    });\n}",
+         "$ xns" : "Roo.bootstrap",
+         "Boolean loadMask" : false,
+         "String style" : "padding: 10px;",
+         "items" : [
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "xtype" : "Column",
+             "Number xs" : 12,
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "listeners" : {
+                "specialkey" : "function (_self, e)\n{\n    if(e.getKey() == 13){\n        _this.dialog.el.select('.modal-content', true).first().mask('Sending...');\n        _this.form.doAction('submit');\n    }\n}"
+               },
+               "inputType" : "password",
+               "xtype" : "Input",
+               "allowBlank" : false,
+               "$ xns" : "Roo.bootstrap",
+               "String fieldLabel" : "Enter your new password",
+               "name" : "password1"
+              },
+              {
+               "listeners" : {
+                "specialkey" : "function (_self, e)\n{\n    if(e.getKey() == 13){\n        _this.dialog.el.select('.modal-content', true).first().mask('Sending...');\n        _this.form.doAction('submit');\n    }\n}"
+               },
+               "inputType" : "password",
+               "xtype" : "Input",
+               "allowBlank" : false,
+               "$ xns" : "Roo.bootstrap",
+               "String fieldLabel" : "Please enter again to confirm",
+               "name" : "password2"
+              },
+              {
+               "String name" : "id",
+               "xtype" : "Input",
+               "String inputType" : "hidden",
+               "$ xns" : "Roo.bootstrap"
+              },
+              {
+               "String name" : "ts",
+               "xtype" : "Input",
+               "String inputType" : "hidden",
+               "$ xns" : "Roo.bootstrap"
+              },
+              {
+               "String name" : "key",
+               "xtype" : "Input",
+               "String inputType" : "hidden",
+               "$ xns" : "Roo.bootstrap"
+              },
+              {
+               "String name" : "ResetPassword",
+               "xtype" : "Input",
+               "String inputType" : "hidden",
+               "$ xns" : "Roo.bootstrap",
+               "string value" : 1
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        }
+       ]
+      }
+     ]
+    }
+   ]
+  }
  ]
 }
\ No newline at end of file
diff --git a/Pman.Dialog.BAdminPasswordReset.js b/Pman.Dialog.BAdminPasswordReset.js
new file mode 100644 (file)
index 0000000..e9dede0
--- /dev/null
@@ -0,0 +1,276 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Dialog');
+
+Pman.Dialog.BAdminPasswordReset= function() {}
+Roo.apply(Pman.Dialog.BAdminPasswordReset.prototype, {
+
+ _strings : {
+  '10ac3d04253ef7e1ddc73e6091c0cd55' :"Next",
+  'bbddd6ba0948d79e55486e615a265b56' :"Enter your new password",
+  'c4ca4238a0b923820dcc509a6f75849b' :"1",
+  '6d70a993714d2699e1d30e03d2753850' :"Please enter again to confirm",
+  '6072e83b7f35887c76e64920bd370f4a' :"Reset Password"
+ },
+ _named_strings : {
+  'ResetPassword_value' : 'c4ca4238a0b923820dcc509a6f75849b' /* 1 */ ,
+  'ok_html' : '10ac3d04253ef7e1ddc73e6091c0cd55' /* Next */ ,
+  'password2_fieldLabel' : '6d70a993714d2699e1d30e03d2753850' /* Please enter again to confirm */ ,
+  'password1_fieldLabel' : 'bbddd6ba0948d79e55486e615a265b56' /* Enter your new password */ 
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+  var _this = this;
+  this.dialog = Roo.factory({
+    xtype : 'Modal',
+    animate : false,
+    buttonPosition : 'center',
+    cls : 'enable-overflow roo-bootstrap-dialog',
+    title : _this._strings['6072e83b7f35887c76e64920bd370f4a'] /* Reset Password */,
+    listeners : {
+     show : function (_self)
+      {
+          _this.dialog.el.select('.modal-content', true).first().unmask();
+          
+      }
+    },
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    buttons : [
+     {
+      xtype : 'Button',
+      html : _this._strings['10ac3d04253ef7e1ddc73e6091c0cd55'] /* Next */,
+      name : 'ok',
+      weight : 'primary',
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.dialog.el.select('.modal-content', true).first().mask('Sending...');
+            _this.form.doAction('submit');
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     }
+    ],
+    items  : [
+     {
+      xtype : 'Row',
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap',
+      items  : [
+       {
+        xtype : 'Container',
+        cls : 'col-md-12',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Form',
+          labelAlign : 'top',
+          loadMask : false,
+          method : 'POST',
+          style : 'padding: 10px;',
+          url : baseURL + '/Login/ResetPassword',
+          verifyCheckSum : function() 
+          { 
+              _this.dialog.hide();
+              
+              new Pman.Request({
+                  url: baseURL + '/Login.php',
+                  method : 'POST',
+                  mask : 'Verifying...',
+                  params : {
+                      id : _this.form.findField('id').getValue(),
+                      ts : _this.form.findField('ts').getValue(),
+                      key : _this.form.findField('key').getValue(),
+                      _verifyCheckSum : 1
+                  },
+                  success : function(res) {
+                      _this.dialog.show();
+                  }
+              });
+          },
+          listeners : {
+           actioncomplete : function (_self, action) {
+            
+                if (action.type == 'setdata') {
+                    
+                    var pathname = window.location.pathname.split('PasswordReset/');
+                    
+                    if(typeof(pathname[1]) == 'undefined'){
+                        return;
+                    }
+                    
+                    var data = pathname[1].split('/');
+                    
+                    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');
+                        return;
+                    }
+                    
+                    _this.form.findField('id').setValue(data[0]);
+                    _this.form.findField('ts').setValue(data[1]);
+                    _this.form.findField('key').setValue(data[2]);
+                
+                    _this.form.clearInvalid();
+                
+                    _this.form.verifyCheckSum();
+                    
+                    return;
+                }
+                if (action.type == 'load') {
+                     
+                    return;
+                }
+                if (action.type =='submit') {
+                    
+                    _this.dialog.hide();
+                    
+                    if (_this.callback) {
+                        _this.callback.call(_this, action.result);
+                    }
+                    
+                    _this.form.reset();
+                    
+                    return;
+                    
+                }
+            },
+           actionfailed : function (_self, action) {
+            
+                Roo.log('action fail?');
+                Roo.log(action);
+                
+                _this.dialog.el.select('.modal-content', true).first().unmask();
+                
+                var err = 'Fill in all the required fields';
+                
+                if (typeof(action) != 'undefined' && action.failureType == 'server') {
+                    err = action.result.errorMsg;
+                }
+                
+                Roo.bootstrap.MessageBox.alert('Error', err);
+            },
+           render : function (_self) {
+                _this.form = _self;
+            }
+          },
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Row',
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            items  : [
+             {
+              xtype : 'Column',
+              xs : 12,
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap',
+              items  : [
+               {
+                xtype : 'Input',
+                allowBlank : false,
+                fieldLabel : _this._strings['bbddd6ba0948d79e55486e615a265b56'] /* Enter your new password */,
+                inputType : 'password',
+                name : 'password1',
+                listeners : {
+                 specialkey : function (_self, e)
+                  {
+                      if(e.getKey() == 13){
+                          _this.dialog.el.select('.modal-content', true).first().mask('Sending...');
+                          _this.form.doAction('submit');
+                      }
+                  }
+                },
+                xns : Roo.bootstrap,
+                '|xns' : 'Roo.bootstrap'
+               },
+               {
+                xtype : 'Input',
+                allowBlank : false,
+                fieldLabel : _this._strings['6d70a993714d2699e1d30e03d2753850'] /* Please enter again to confirm */,
+                inputType : 'password',
+                name : 'password2',
+                listeners : {
+                 specialkey : function (_self, e)
+                  {
+                      if(e.getKey() == 13){
+                          _this.dialog.el.select('.modal-content', true).first().mask('Sending...');
+                          _this.form.doAction('submit');
+                      }
+                  }
+                },
+                xns : Roo.bootstrap,
+                '|xns' : 'Roo.bootstrap'
+               },
+               {
+                xtype : 'Input',
+                inputType : 'hidden',
+                name : 'id',
+                xns : Roo.bootstrap,
+                '|xns' : 'Roo.bootstrap'
+               },
+               {
+                xtype : 'Input',
+                inputType : 'hidden',
+                name : 'ts',
+                xns : Roo.bootstrap,
+                '|xns' : 'Roo.bootstrap'
+               },
+               {
+                xtype : 'Input',
+                inputType : 'hidden',
+                name : 'key',
+                xns : Roo.bootstrap,
+                '|xns' : 'Roo.bootstrap'
+               },
+               {
+                xtype : 'Input',
+                inputType : 'hidden',
+                name : 'ResetPassword',
+                value : 1,
+                xns : Roo.bootstrap,
+                '|xns' : 'Roo.bootstrap'
+               }
+              ]
+             }
+            ]
+           }
+          ]
+         }
+        ]
+       }
+      ]
+     }
+    ]
+   }  );
+ }
+});
+Roo.apply(Pman.Dialog.BAdminPasswordReset, Pman.Dialog.BAdminPasswordReset.prototype);