Guest User

Untitled

a guest
Jun 21st, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.44 KB | None | 0 0
  1. zach@plantard:/var/www/zach$ diff actions/designsettings.php ../evan/actions/designsettings.php
  2. 35a36,37
  3. >
  4. >
  5. 101c103,115
  6. < $design = $user->getDesign();
  7. ---
  8. > //This is a JSON object in the DB field. Here for testing. Remove later.
  9. > $userSwatch = '{"body":{"background-color":"#F0F2F5"},
  10. > "#content":{"background-color":"#FFFFFF"},
  11. > "#aside_primary":{"background-color":"#CEE1E9"},
  12. > "html body":{"color":"#000000"},
  13. > "a":{"color":"#002E6E"}}';
  14. >
  15. > //Default theme swatch -- Where should this be stored?
  16. > $defaultSwatch = array('body' => array('background-color' => '#F0F2F5'),
  17. > '#content' => array('background-color' => '#FFFFFF'),
  18. > '#aside_primary' => array('background-color' => '#CEE1E9'),
  19. > 'html body' => array('color' => '#000000'),
  20. > 'a' => array('color' => '#002E6E'));
  21. 103,105c117
  22. < if (empty($design)) {
  23. < $design = $this->defaultDesign();
  24. < }
  25. ---
  26. > $userSwatch = ($userSwatch) ? json_decode($userSwatch, true) : $defaultSwatch;
  27. 106a119
  28. > $s = 0;
  29. 112d124
  30. <
  31. 138,143c150,154
  32. < /*TODO: Check submitted form values:
  33. < json_encode(form values)
  34. < if submitted Swatch == DefaultSwatch, don't store in DB.
  35. < else store in BD
  36. < */
  37. <
  38. ---
  39. > /*TODO: Check submitted form values:
  40. > json_encode(form values)
  41. > if submitted Swatch == DefaultSwatch, don't store in DB.
  42. > else store in BD
  43. > */
  44. 145a157
  45. >
  46. 159,160c171,224
  47. < // TODO: implement this
  48. < return;
  49. ---
  50. > /*
  51. > // CSRF protection
  52. >
  53. > $token = $this->trimmed('token');
  54. > if (!$token || $token != common_session_token()) {
  55. > $this->showForm(_('There was a problem with your session token. '.
  56. > 'Try again, please.'));
  57. > return;
  58. > }
  59. >
  60. > $user = common_current_user();
  61. > assert(!is_null($user)); // should already be checked
  62. >
  63. > // FIXME: scrub input
  64. >
  65. > $newpassword = $this->arg('newpassword');
  66. > $confirm = $this->arg('confirm');
  67. >
  68. > # Some validation
  69. >
  70. > if (strlen($newpassword) < 6) {
  71. > $this->showForm(_('Password must be 6 or more characters.'));
  72. > return;
  73. > } else if (0 != strcmp($newpassword, $confirm)) {
  74. > $this->showForm(_('Passwords don\'t match.'));
  75. > return;
  76. > }
  77. >
  78. > if ($user->password) {
  79. > $oldpassword = $this->arg('oldpassword');
  80. >
  81. > if (!common_check_user($user->nickname, $oldpassword)) {
  82. > $this->showForm(_('Incorrect old password'));
  83. > return;
  84. > }
  85. > }
  86. >
  87. > $original = clone($user);
  88. >
  89. > $user->password = common_munge_password($newpassword, $user->id);
  90. >
  91. > $val = $user->validate();
  92. > if ($val !== true) {
  93. > $this->showForm(_('Error saving user; invalid.'));
  94. > return;
  95. > }
  96. >
  97. > if (!$user->update($original)) {
  98. > $this->serverError(_('Can\'t save new password.'));
  99. > return;
  100. > }
  101. >
  102. > $this->showForm(_('Password saved.'), true);
  103. > */
  104. 162a227
  105. >
Add Comment
Please, Sign In to add comment