mirror of https://github.com/sipwise/ngcp-csc.git
Implement ngcp-csc account module mockup, linked with corresponsing logged in ACL account. Also remove some console.logs, delete unneeded bootstrap.js and bootstrap.css files, and replace main model username object with formula object to correctly display username in header also immediately after log in. Cleanups and small refactoring in new patchset. Change-Id: I91d4b7bfbaf7d27908640b9f730024f63b729695changes/79/9379/3
parent
bba515ed55
commit
160a1dd766
@ -1,9 +0,0 @@
|
||||
|
||||
|
||||
/*
|
||||
* This file is generated by Sencha Cmd and should NOT be edited. It redirects
|
||||
* to the most recently built CSS file for the application to allow index.html
|
||||
* in the development directory to load properly (i.e., "dev mode").
|
||||
*/
|
||||
@import 'build/production/NgcpCsc/resources/NgcpCsc-all.css';
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,4 @@
|
||||
// custom rules
|
||||
.account-username {
|
||||
margin-left: 40px;
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
Ext.define('NgcpCsc.view.pages.account.Account', {
|
||||
extend: 'Ext.panel.Panel',
|
||||
|
||||
xtype: 'account',
|
||||
|
||||
controller: 'account',
|
||||
|
||||
title: Ngcp.csc.locales.account.title[localStorage.getItem('languageSelected')],
|
||||
|
||||
defaults: {
|
||||
padding: 20
|
||||
},
|
||||
|
||||
items: [{
|
||||
height: 60,
|
||||
padding: '20 0 5 20',
|
||||
html: Ngcp.csc.locales.account.subtitle[localStorage.getItem('languageSelected')]
|
||||
}, {
|
||||
height: 60,
|
||||
padding: '20 0 5 20',
|
||||
html: Ngcp.csc.locales.account.password_instructions[localStorage.getItem('languageSelected')]
|
||||
}, {
|
||||
xtype: 'accountform'
|
||||
}, {
|
||||
xtype: 'container',
|
||||
height: 40,
|
||||
padding: '10 0 10 10',
|
||||
html: Ngcp.csc.locales.account.change_password[localStorage.getItem('languageSelected')].toLowerCase(),
|
||||
cls: 'link',
|
||||
listeners: {
|
||||
click: {
|
||||
element: 'el',
|
||||
fn: 'submitForm'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
xtype: 'container',
|
||||
height: 40,
|
||||
padding: '10 0 10 10',
|
||||
html: Ngcp.csc.locales.account.reset_form[localStorage.getItem('languageSelected')].toLowerCase(),
|
||||
cls: 'link',
|
||||
listeners: {
|
||||
click: {
|
||||
element: 'el',
|
||||
fn: 'resetForm'
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
||||
});
|
||||
@ -0,0 +1,38 @@
|
||||
Ext.define('NgcpCsc.view.pages.account.AccountController', {
|
||||
extend: 'Ext.app.ViewController',
|
||||
|
||||
alias: 'controller.account',
|
||||
|
||||
resetForm: function() {
|
||||
this.getViewModel().set('old-password', '');
|
||||
this.getViewModel().set('new-password', '');
|
||||
this.getViewModel().set('repeat-password', '');
|
||||
},
|
||||
|
||||
submitForm: function(field) {
|
||||
var oldPassword = localStorage.getItem('password');
|
||||
var enteredOldPassword = this.getViewModel().get('old-password');
|
||||
var newPassword = this.getViewModel().get('new-password');
|
||||
var repeatPassword = this.getViewModel().get('repeat-password');
|
||||
if (enteredOldPassword === null) {
|
||||
this.fireEvent('showmessage', false, Ngcp.csc.locales.account.enter_current[localStorage.getItem('languageSelected')]);
|
||||
} else if (newPassword.length < 6 || repeatPassword.length < 6) {
|
||||
this.fireEvent('showmessage', false, Ngcp.csc.locales.account.password_short[localStorage.getItem('languageSelected')]);
|
||||
} else if (oldPassword === enteredOldPassword && newPassword === repeatPassword) {
|
||||
localStorage.setItem('password', newPassword);
|
||||
this.fireEvent('showmessage', true, Ngcp.csc.locales.account.change_success[localStorage.getItem('languageSelected')]);
|
||||
} else if (newPassword !== repeatPassword) {
|
||||
this.fireEvent('showmessage', false, Ngcp.csc.locales.account.password_match[localStorage.getItem('languageSelected')]);
|
||||
} else if (oldPassword !== enteredOldPassword) {
|
||||
this.fireEvent('showmessage', false, Ngcp.csc.locales.account.wrong_password[localStorage.getItem('languageSelected')]);
|
||||
};
|
||||
this.resetForm();
|
||||
},
|
||||
|
||||
onEnterPressed: function (field, el) {
|
||||
if (el.getKey() == el.ENTER) {
|
||||
this.submitForm(field.id);
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
@ -0,0 +1,58 @@
|
||||
Ext.define('NgcpCsc.view.pages.account.AccountForm', {
|
||||
extend: 'Ext.form.Panel',
|
||||
|
||||
xtype: 'accountform',
|
||||
|
||||
viewModel: 'account',
|
||||
|
||||
store: 'Account',
|
||||
|
||||
defaults: {
|
||||
width: 750
|
||||
},
|
||||
|
||||
items: [{
|
||||
xtype: 'container',
|
||||
bind: '{username}',
|
||||
padding: '0 0 15 0'
|
||||
}, {
|
||||
xtype: 'textfield',
|
||||
inputType: 'password',
|
||||
fieldLabel: 'old password',
|
||||
name: 'account-old-password',
|
||||
bind: '{old-password}',
|
||||
listeners: {
|
||||
specialKey: 'onEnterPressed'
|
||||
}
|
||||
}, {
|
||||
xtype: 'fieldcontainer',
|
||||
labelStyle: 'font-weight:bold;padding:0;',
|
||||
layout: 'hbox',
|
||||
defaultType: 'textfield',
|
||||
|
||||
fieldDefaults: {
|
||||
labelAlign: 'right'
|
||||
},
|
||||
items: [{
|
||||
flex: 2,
|
||||
inputType: 'password',
|
||||
fieldLabel: 'new password',
|
||||
name: 'account-new-password',
|
||||
bind: '{new-password}',
|
||||
listeners: {
|
||||
specialKey: 'onEnterPressed'
|
||||
}
|
||||
}, {
|
||||
flex: 2,
|
||||
inputType: 'password',
|
||||
fieldLabel: 'repeat',
|
||||
name: 'account-repeat-password',
|
||||
margin: '0 0 0 5',
|
||||
bind: '{repeat-password}',
|
||||
listeners: {
|
||||
specialKey: 'onEnterPressed'
|
||||
}
|
||||
}]
|
||||
}]
|
||||
|
||||
});
|
||||
@ -0,0 +1,17 @@
|
||||
Ext.define('NgcpCsc.view.pages.account.AccountModel', {
|
||||
extend: 'Ext.app.ViewModel',
|
||||
alias: 'viewmodel.account',
|
||||
|
||||
data: {
|
||||
new_password: '',
|
||||
old_password: '',
|
||||
repeat_password: ''
|
||||
},
|
||||
|
||||
formulas: {
|
||||
username: function(get) {
|
||||
return Ext.String.format('{0}: <span class="account-username">{1}</span>', Ngcp.csc.locales.account.username[localStorage.getItem('languageSelected')], localStorage.getItem('username'));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
Loading…
Reference in new issue