Advertisement
Guest User

Untitled

a guest
Jun 6th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. changepassword: function () {
  2. app.addPopup(ChangePasswordPopup);
  3. },
  4. var ChangePasswordPopup = this.ChangePasswordPopup = Popup.extend({
  5. type: 'semimodal',
  6. initialize: function (data) {
  7. var buf = '<form>';
  8. if (data.error) {
  9. buf += '<p class="error">' + data.error + '</p>';
  10. } else {
  11. buf += '<p>Change your password:</p>';
  12. }
  13. buf += '<p><label class="label">Username: <strong>' + app.user.get('name') + '</strong></label></p>';
  14. buf += '<p><label class="label">Old password: <input class="textbox autofocus" type="password" name="oldpassword" /></label></p>';
  15. buf += '<p><label class="label">New password: <input class="textbox" type="password" name="password" /></label></p>';
  16. buf += '<p><label class="label">New password (confirm): <input class="textbox" type="password" name="cpassword" /></label></p>';
  17. buf += '<p class="buttonbar"><button type="submit"><strong>Change password</strong></button> <button name="close">Cancel</button></p></form>';
  18. this.$el.html(buf);
  19. },
  20. submit: function (data) {
  21. $.post(app.user.getActionPHP(), {
  22. act: 'changepassword',
  23. oldpassword: data.oldpassword,
  24. password: data.password,
  25. cpassword: data.cpassword
  26. }, Tools.safeJSON(function (data) {
  27. if (!data) data = {};
  28. if (data.actionsuccess) {
  29. app.addPopupMessage("Your password was successfully changed.");
  30. } else {
  31. app.addPopup(ChangePasswordPopup, {
  32. error: data.actionerror
  33. });
  34. }
  35. }), 'text');
  36. }
  37. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement