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

59 lines
1.2 KiB
JavaScript
Executable File

Vn.Conf = new Class
({
Extends: Vn.Module
,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');
}
,onPasswordChange: function ()
{
var newPassword = this.$('new-password').value;
var repeatedPassword = this.$('repeat-password').value;
if (newPassword != '' && repeatedPassword != '')
{
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';
this.conn.execQuery (query, this.onPasswordUpdate.bind (this), batch);
}
else
Htk.Toast.showError (_('PasswordsDoesntMatch'));
}
}
,onPasswordUpdate: function (resultSet)
{
if (!resultSet.fetchResult ())
return;
this.relogin ();
Htk.Toast.showMessage (_('PasswordsChanged'));
}
,relogin: function ()
{
this.conn.open (
this.$('user-form').get ('name')
,this.$('new-password').value
,Vn.Cookie.check ('vn_pass')
);
}
,onAddressesClick: function ()
{
this.hash.set ({'form': 'account/address-list'});
}
});