2015-01-23 13:09:30 +00:00
|
|
|
|
2015-03-19 19:36:11 +00:00
|
|
|
Vn.Conf = new Class
|
2015-01-23 13:09:30 +00:00
|
|
|
({
|
2015-11-17 10:34:33 +00:00
|
|
|
Extends: Vn.Form
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
,activate: function ()
|
|
|
|
{
|
2015-03-27 19:10:49 +00:00
|
|
|
this.$('user-model').setInfo ('u', 'user_view', 'hedera');
|
|
|
|
this.$('user-model').setInfo ('c', 'customer_view', 'hedera');
|
|
|
|
this.$('addresses').setInfo ('a', 'address_view', 'hedera');
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
2015-03-06 23:33:54 +00:00
|
|
|
,onPasswordChange: function ()
|
|
|
|
{
|
|
|
|
var newPassword = this.$('new-password').value;
|
|
|
|
var repeatedPassword = this.$('repeat-password').value;
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
if (newPassword != '' && repeatedPassword != '')
|
|
|
|
{
|
2015-03-06 23:33:54 +00:00
|
|
|
if (newPassword === repeatedPassword)
|
2015-01-23 13:09:30 +00:00
|
|
|
{
|
|
|
|
var batch = new Sql.Batch ();
|
|
|
|
batch.addValue ('password', newPassword);
|
|
|
|
|
|
|
|
var query = 'UPDATE user_view SET password = MD5(#password) '
|
|
|
|
+'WHERE id = account.user_get_id () LIMIT 1';
|
|
|
|
|
2015-03-06 23:33:54 +00:00
|
|
|
this.conn.execQuery (query, this.onPasswordUpdate.bind (this), batch);
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
2015-03-06 23:33:54 +00:00
|
|
|
else
|
2015-08-17 18:02:14 +00:00
|
|
|
Htk.Toast.showError (_('PasswordsDoesntMatch'));
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-06 23:33:54 +00:00
|
|
|
,onPasswordUpdate: function (resultSet)
|
2015-01-23 13:09:30 +00:00
|
|
|
{
|
|
|
|
if (!resultSet.fetchResult ())
|
|
|
|
return;
|
2015-03-06 23:33:54 +00:00
|
|
|
|
|
|
|
this.relogin ();
|
2015-08-17 18:02:14 +00:00
|
|
|
Htk.Toast.showMessage (_('PasswordsChanged'));
|
2015-03-06 23:33:54 +00:00
|
|
|
}
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2015-03-06 23:33:54 +00:00
|
|
|
,relogin: function ()
|
|
|
|
{
|
|
|
|
this.conn.open (
|
|
|
|
this.$('user-form').get ('name')
|
|
|
|
,this.$('new-password').value
|
|
|
|
,Vn.Cookie.check ('vn_pass')
|
|
|
|
);
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
2015-03-27 19:10:49 +00:00
|
|
|
|
2015-07-23 15:58:48 +00:00
|
|
|
,onAddressesClick: function ()
|
2015-03-27 19:10:49 +00:00
|
|
|
{
|
2015-07-23 15:58:48 +00:00
|
|
|
this.hash.set ({'form': 'account/address-list'});
|
2015-03-27 19:10:49 +00:00
|
|
|
}
|
2015-01-23 13:09:30 +00:00
|
|
|
});
|
|
|
|
|