0
1
Fork 0
hedera-web-mindshore/web/forms/account/conf/conf.js

59 lines
1.2 KiB
JavaScript
Raw Normal View History

Vn.Conf = new Class
({
Extends: Vn.Form
,activate: function ()
{
this.$('user-model').setInfo ('u', 'user_view', 'hedera');
this.$('user-model').setInfo ('c', 'customer_view', 'hedera');
this.$('addresses').setInfo ('a', 'address_view', 'hedera');
}
2015-03-06 23:33:54 +00:00
,onPasswordChange: function ()
{
var newPassword = this.$('new-password').value;
var repeatedPassword = this.$('repeat-password').value;
if (newPassword != '' && repeatedPassword != '')
{
2015-03-06 23:33:54 +00:00
if (newPassword === repeatedPassword)
{
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-03-06 23:33:54 +00:00
else
2015-08-17 18:02:14 +00:00
Htk.Toast.showError (_('PasswordsDoesntMatch'));
}
}
2015-03-06 23:33:54 +00:00
,onPasswordUpdate: function (resultSet)
{
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-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-07-23 15:58:48 +00:00
,onAddressesClick: function ()
{
2015-07-23 15:58:48 +00:00
this.hash.set ({'form': 'account/address-list'});
}
});