Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- changepassword: function () {
- app.addPopup(ChangePasswordPopup);
- },
- var ChangePasswordPopup = this.ChangePasswordPopup = Popup.extend({
- type: 'semimodal',
- initialize: function (data) {
- var buf = '<form>';
- if (data.error) {
- buf += '<p class="error">' + data.error + '</p>';
- } else {
- buf += '<p>Change your password:</p>';
- }
- buf += '<p><label class="label">Username: <strong>' + app.user.get('name') + '</strong></label></p>';
- buf += '<p><label class="label">Old password: <input class="textbox autofocus" type="password" name="oldpassword" /></label></p>';
- buf += '<p><label class="label">New password: <input class="textbox" type="password" name="password" /></label></p>';
- buf += '<p><label class="label">New password (confirm): <input class="textbox" type="password" name="cpassword" /></label></p>';
- buf += '<p class="buttonbar"><button type="submit"><strong>Change password</strong></button> <button name="close">Cancel</button></p></form>';
- this.$el.html(buf);
- },
- submit: function (data) {
- $.post(app.user.getActionPHP(), {
- act: 'changepassword',
- oldpassword: data.oldpassword,
- password: data.password,
- cpassword: data.cpassword
- }, Tools.safeJSON(function (data) {
- if (!data) data = {};
- if (data.actionsuccess) {
- app.addPopupMessage("Your password was successfully changed.");
- } else {
- app.addPopup(ChangePasswordPopup, {
- error: data.actionerror
- });
- }
- }), 'text');
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement