mirror of https://github.com/sipwise/ngcp-csc.git
Change-Id: I66faad60a03fddafb0748928874494633b2af5dechanges/84/12084/2
parent
280d3a9889
commit
aca392892b
@ -1,47 +0,0 @@
|
||||
Ext.define('NgcpCsc.view.pages.password.Password', {
|
||||
extend: 'Ext.panel.Panel',
|
||||
|
||||
xtype: 'password',
|
||||
|
||||
controller: 'password',
|
||||
|
||||
viewModel: 'password',
|
||||
|
||||
initComponent: function() {
|
||||
this.items = [{
|
||||
layout: 'responsivecolumn',
|
||||
xtype:'core-container',
|
||||
items: [{
|
||||
padding: '0 0 5 0',
|
||||
html: Ngcp.csc.locales.common.password[localStorage.getItem('languageSelected')].toUpperCase()
|
||||
}, {
|
||||
padding: '0 0 5 0',
|
||||
html: Ngcp.csc.locales.password.password_instructions[localStorage.getItem('languageSelected')]
|
||||
}, {
|
||||
userCls: 'big-66 small-100',
|
||||
items:[{
|
||||
xtype: 'passwordform'
|
||||
},
|
||||
{
|
||||
layout: 'hbox',
|
||||
margin: '20 0 0 0',
|
||||
defaults: {
|
||||
xtype: 'button',
|
||||
flex: 1
|
||||
},
|
||||
items: [{
|
||||
text: Ngcp.csc.locales.password.change_password[localStorage.getItem('languageSelected')].toLowerCase(),
|
||||
margin: '0 5 0 0',
|
||||
handler: 'submitForm'
|
||||
}, {
|
||||
text: Ngcp.csc.locales.common.reset_form[localStorage.getItem('languageSelected')].toLowerCase(),
|
||||
handler: 'resetForm'
|
||||
}]
|
||||
}]
|
||||
}
|
||||
]
|
||||
}];
|
||||
this.callParent();
|
||||
}
|
||||
|
||||
});
|
||||
@ -1,38 +0,0 @@
|
||||
Ext.define('NgcpCsc.view.pages.password.PasswordController', {
|
||||
extend: 'Ext.app.ViewController',
|
||||
|
||||
alias: 'controller.password',
|
||||
|
||||
resetForm: function() {
|
||||
this.getViewModel().set('credentials.old_password', '');
|
||||
this.getViewModel().set('credentials.new_password', '');
|
||||
this.getViewModel().set('credentials.repeat_password', '');
|
||||
},
|
||||
|
||||
submitForm: function(field) {
|
||||
var oldPassword = localStorage.getItem('password');
|
||||
var enteredOldPassword = this.getViewModel().get('credentials.old_password');
|
||||
var newPassword = this.getViewModel().get('credentials.new_password');
|
||||
var repeatPassword = this.getViewModel().get('credentials.repeat_password');
|
||||
if (enteredOldPassword === null) {
|
||||
this.fireEvent('showmessage', false, Ngcp.csc.locales.password.enter_current[localStorage.getItem('languageSelected')]);
|
||||
} else if (newPassword.length < 6 || repeatPassword.length < 6) {
|
||||
this.fireEvent('showmessage', false, Ngcp.csc.locales.password.password_short[localStorage.getItem('languageSelected')]);
|
||||
} else if (oldPassword === enteredOldPassword && newPassword === repeatPassword) {
|
||||
localStorage.setItem('password', newPassword);
|
||||
this.fireEvent('showmessage', true, Ngcp.csc.locales.password.change_success[localStorage.getItem('languageSelected')]);
|
||||
} else if (newPassword !== repeatPassword) {
|
||||
this.fireEvent('showmessage', false, Ngcp.csc.locales.password.password_match[localStorage.getItem('languageSelected')]);
|
||||
} else if (oldPassword !== enteredOldPassword) {
|
||||
this.fireEvent('showmessage', false, Ngcp.csc.locales.password.wrong_password[localStorage.getItem('languageSelected')]);
|
||||
};
|
||||
this.resetForm();
|
||||
},
|
||||
|
||||
onEnterPressed: function (field, el) {
|
||||
if (el.getKey() == el.ENTER) {
|
||||
this.submitForm(field.id);
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
@ -1,48 +0,0 @@
|
||||
Ext.define('NgcpCsc.view.pages.password.PasswordForm', {
|
||||
extend: 'Ext.form.Panel',
|
||||
|
||||
xtype: 'passwordform',
|
||||
|
||||
defaults: {
|
||||
width: '100%'
|
||||
},
|
||||
|
||||
items: [{
|
||||
xtype: 'container',
|
||||
bind: '{username}',
|
||||
margin: '0 0 10 0'
|
||||
}, {
|
||||
xtype: 'textfield',
|
||||
inputType: 'password',
|
||||
fieldLabel: Ngcp.csc.locales.password.field_labels.old_password[localStorage.getItem('languageSelected')],
|
||||
name: 'account-old-password',
|
||||
bind: '{credentials.old_password}',
|
||||
listeners: {
|
||||
specialKey: 'onEnterPressed'
|
||||
}
|
||||
}, {
|
||||
xtype: 'fieldcontainer',
|
||||
defaultType: 'textfield',
|
||||
defaults: {
|
||||
width: '100%'
|
||||
},
|
||||
items: [{
|
||||
inputType: 'password',
|
||||
fieldLabel: Ngcp.csc.locales.password.field_labels.new_password[localStorage.getItem('languageSelected')],
|
||||
name: 'account-new-password',
|
||||
bind: '{credentials.new_password}',
|
||||
listeners: {
|
||||
specialKey: 'onEnterPressed'
|
||||
}
|
||||
}, {
|
||||
inputType: 'password',
|
||||
fieldLabel: Ngcp.csc.locales.password.field_labels.repeat_password[localStorage.getItem('languageSelected')],
|
||||
name: 'account-repeat-password',
|
||||
bind: '{credentials.repeat_password}',
|
||||
listeners: {
|
||||
specialKey: 'onEnterPressed'
|
||||
}
|
||||
}]
|
||||
}]
|
||||
|
||||
});
|
||||
@ -1,18 +0,0 @@
|
||||
Ext.define('NgcpCsc.view.pages.password.PasswordModel', {
|
||||
extend: 'Ext.app.ViewModel',
|
||||
alias: 'viewmodel.password',
|
||||
|
||||
links: {
|
||||
credentials: {
|
||||
type: 'NgcpCsc.model.Password',
|
||||
id: Ext.id()
|
||||
}
|
||||
},
|
||||
|
||||
formulas: {
|
||||
username: function(get) {
|
||||
return Ext.String.format('{0}: <span class="account-username">{1}</span>', Ngcp.csc.locales.common.username[localStorage.getItem('languageSelected')], localStorage.getItem('username'));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
Loading…
Reference in new issue