/* * * File: forgot_password.php * * Description: CMS Ext Forgot password form * */ Ext.define('EnertechXchange.CMS.ForgotPassword', { extend : 'Ext.form.Panel', id: 'forgotPasswordForm', scope: this, initComponent:function() { Ext.apply(this, { hidden: true, frame:true, scope: this, title: 'Forgot Password', layout : 'anchor', width: 350, items: [ this.fieldset = new Ext.form.FieldSet({ style: 'margin-top: 5px;', items: [ this.username = new Ext.form.TextField({ allowBlank: false, fieldLabel: 'User Name *', name: 'username', listeners: { scope: this, specialkey: function(f,e){ if ( e.getKey() == e.RETURN || e.getKey() == e.ENTER) { this.doForgotPassword(); } } } }), { xtype: 'container', padding: '5 0 0 0', style: { 'text-align': 'right' }, items: [{ scope: this, xtype : 'button', handler: this.doForgotPassword, iconCls: 'iconNewsletterSendNow', text: 'Send Request', padding: '2 10 2 10' }] } ] }), this.errorForgotPasswordMessage = new Ext.container.Container({ bodyStyle: 'margin: 10px 10px 5px 10px; text-align: center', hidden: true }) ] //end of items }); EnertechXchange.CMS.ForgotPassword.superclass.initComponent.apply(this, arguments); }, doForgotPassword:function(){ if (this.username.getValue() == '') { this.username.markInvalid('This field is required'); return; } this.getForm().submit({ scope: this, url: 'ajax/login_ajax.php', params: { 'a' : 'afp', 'username' : this.username }, success:function(form, action) { var obj = Ext.JSON.decode(action.response.responseText); if (obj.success) { this.errorForgotPasswordMessage.el.dom.innerHTML = '

' + obj.message + '

'; this.errorForgotPasswordMessage.show(); } }, failure:function(form, action) { var obj = Ext.JSON.decode(action.response.responseText); this.username.markInvalid('User Name might be invalid'); this.errorForgotPasswordMessage.el.dom.innerHTML = ''; this.errorForgotPasswordMessage.el.dom.innerHTML = '

' + obj.message + '

'; this.errorForgotPasswordMessage.show(); } }); } }); //end of form panel