My SMM panel
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

125 rindas
3.7 KiB

  1. <template>
  2. <div>
  3. <h3>Settings</h3>
  4. <section class="billing-pane">
  5. <h4>Billing</h4>
  6. <edit-cards :preferred="user.payment_method" :token="token"></edit-cards>
  7. </section>
  8. <section class="change-name-pane">
  9. <h4>Name</h4>
  10. <input :value="user.name" name="name" id="changed_name" type="text">
  11. <button @click="changeName">Save <loading src="../../images/loading-white.svg" alt=""></loading></button>
  12. <span></span>
  13. </section>
  14. <section class="change-email-pane">
  15. <h4>Email</h4>
  16. <input :value="user.email" name="email" type="text" id="changed_email">
  17. <button @click="changeEmail">Save<img class="loading-icon" src="../../images/loading-white.svg" alt=""></button>
  18. <span></span>
  19. </section>
  20. <section class="change-password-pane">
  21. <h4>Change Password</h4>
  22. <h5>Current Password</h5><input name="current_passowrd" id="current_password" type="password">
  23. <h5>New Password</h5><input id="new_password" name="password" type="password">
  24. <h5>Confirm Password</h5><input id="confirm_password" name="confirm_passowrd" type="password">
  25. <button @click="changePassword">Save<img class="loading-icon" src="../../images/loading-white.svg" alt=""></button>
  26. <span></span>
  27. </section>
  28. </div>
  29. </template>
  30. <script>
  31. import Loading from '../icons/loading.vue'
  32. import EditCards from './edit-cards.vue'
  33. function changeName() {
  34. let name = document.getElementById('changed_name').value
  35. let info = document.querySelector('.change-name-pane span')
  36. let pane = document.querySelector('.change-name-pane')
  37. pane.classList.add('loading')
  38. pane.classList.remove('error')
  39. fetch("/panel/change-name", {
  40. method: 'POST',
  41. headers: {'Content-Type': 'application/json',
  42. 'Accept': 'application/json',
  43. 'X-XSRF-TOKEN': this.token},
  44. body: JSON.stringify({'name': name}),
  45. }).then(response => {
  46. if (response.ok) {
  47. pane.classList.add('completed')
  48. info.textContent = 'Completed'
  49. } else {
  50. pane.classList.add('error')
  51. info.textContent = 'Error: ' + response.status
  52. }
  53. pane.classList.remove('loading')
  54. })
  55. }
  56. function changeEmail() {
  57. let email = document.getElementById('changed_email').value
  58. let info = document.querySelector('.change-email-pane span')
  59. let pane = document.querySelector('.change-email-pane')
  60. pane.classList.add('loading')
  61. pane.classList.remove('error')
  62. fetch("/panel/change-email", {
  63. method: 'POST',
  64. headers: {'Content-Type': 'application/json',
  65. 'Accept': 'application/json',
  66. 'X-XSRF-TOKEN': this.token},
  67. body: JSON.stringify({'email': email}),
  68. }).then(response => {
  69. if (response.ok) {
  70. pane.classList.add('completed')
  71. info.textContent = 'Verification link sent'
  72. } else {
  73. pane.classList.add('error')
  74. info.textContent = 'Error: ' + response.status
  75. }
  76. pane.classList.remove('loading')
  77. })
  78. }
  79. function changePassword() {
  80. let info = document.querySelector('.change-password-pane span')
  81. let pane = document.querySelector('.change-password-pane')
  82. pane.classList.add('loading')
  83. pane.classList.remove('error')
  84. fetch("/panel/change-password", {
  85. method: 'POST',
  86. headers: {'Content-Type': 'application/json',
  87. 'Accept': 'application/json',
  88. 'X-XSRF-TOKEN': this.token},
  89. body: JSON.stringify({'current_password':
  90. document.getElementById('current_password').value,
  91. 'password': document.getElementById('new_password').value,
  92. 'password_confirmation':
  93. document.getElementById('confirm_password').value}),
  94. }).then(response => {
  95. response.json().then(data => {console.log(data)})
  96. if (response.ok) {
  97. pane.classList.add('completed')
  98. info.textContent = 'Completed'
  99. } else {
  100. pane.classList.add('error')
  101. info.textContent = 'Error: ' + response.status
  102. }
  103. pane.classList.remove('loading')
  104. })
  105. }
  106. export default {
  107. components: {Loading, EditCards},
  108. methods: {
  109. changePassword, changeName, changeEmail
  110. },
  111. props: ['user', 'token']
  112. }
  113. </script>