Hedera.Conf = new Class ({ Extends: Hedera.Form ,activate: function () { this.$('user-model').setInfo ('c', 'customer_view', 'hedera'); this.$('addresses').setInfo ('a', 'address_view', 'hedera'); } ,onPassChangeClick: function () { this.$('old-password').value = ''; this.$('new-password').value = ''; this.$('repeat-password').value = ''; var hasPassword = this.$('user-form').get ('hasPassword'); this.$('old-password').style.display = hasPassword ? 'block' : 'none'; this.$('change-password').show (); if (hasPassword) this.$('old-password').focus (); else this.$('new-password').focus (); } ,onPassModifyClick: function () { try { var oldPassword = this.$('old-password').value; var newPassword = this.$('new-password').value; var repeatedPassword = this.$('repeat-password').value; if (newPassword == '' && repeatedPassword == '') throw new Error (_('Passwords empty')); if (newPassword !== repeatedPassword) throw new Error (_('Passwords doesn\'t match')); var batch = new Sql.Batch (); batch.addValue ('oldPassword', oldPassword); batch.addValue ('newPassword', newPassword); var query = 'CALL account.userChangePassword (#oldPassword, #newPassword)'; this.conn.execQuery (query, this.onPasswordUpdate.bind (this), batch); } catch (e) { Htk.Toast.showError (e.message); } } ,onPasswordUpdate: function (resultSet) { try { resultSet.fetchResult (); this.$('change-password').hide (); Htk.Toast.showMessage (_('Password changed!')); } catch (e) { Htk.Toast.showError (_('Password doesn\'t meet the requirements')); this.$('old-password').select (); } } ,onPassInfoClick: function () { this.$('password-info').show (); } ,onAddressesClick: function () { this.hash.set ({'form': 'account/address-list'}); } });