Settings.vue 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <main-header></main-header>
  3. <div class="container">
  4. <!--Implement Validation-->
  5. <label class="label">Username</label>
  6. <p class="control has-icon has-icon-right">
  7. <input class="input is-success" type="text" placeholder="Change username" :value="user.username" v-model="user.username">
  8. <!--Remove validation if it's their own without changing-->
  9. <i class="fa fa-check"></i>
  10. <span class="help is-success">This username is available</span>
  11. </p>
  12. <label class="label">Email</label>
  13. <p class="control has-icon has-icon-right">
  14. <input class="input is-danger" type="text" placeholder="Change email address" :value="user.email" v-model="user.email">
  15. <!--Remove validation if it's their own without changing-->
  16. <i class="fa fa-warning"></i>
  17. <span class="help is-danger">This email is invalid</span>
  18. </p>
  19. <label class="label">Change Password</label>
  20. <div class="control is-grouped">
  21. <p class="control is-expanded has-icon has-icon-right">
  22. <input class="input is-danger" type="text" placeholder="Enter current password">
  23. <!-- Check if correct -->
  24. <i class="fa fa-warning"></i>
  25. <span class="help is-danger">This password is invalid</span>
  26. </p>
  27. <p class="control is-expanded has-icon has-icon-right">
  28. <input class="input is-danger" type="text" placeholder="Enter new password" v-model="user.password">
  29. <!--Check if longer than x chars, has x, x and x. Kris likes x too ;)-->
  30. <i class="fa fa-warning"></i>
  31. <span class="help is-danger">This password is invalid</span>
  32. </p>
  33. </div>
  34. <p class="control">
  35. <button class="button is-success">Save Changes</button>
  36. </p>
  37. </div>
  38. <main-footer></main-footer>
  39. </template>
  40. <script>
  41. import MainHeader from '../MainHeader.vue';
  42. import MainFooter from '../MainFooter.vue';
  43. export default {
  44. data() {
  45. return {
  46. user: {}
  47. }
  48. },
  49. ready: function() {
  50. let _this = this;
  51. let socketInterval = setInterval(() => {
  52. if (!!_this.$parent.socket) {
  53. _this.socket = _this.$parent.socket;
  54. // need to refactor to send whoever is currently logged in
  55. _this.socket.emit('users.findByUsername', 'atjonathan', res => {
  56. if (res.status == 'error') console.error(res.message); // Add 404/ Not found Component with link back to home, for now just console.log
  57. else _this.user = res.data;
  58. });
  59. clearInterval(socketInterval);
  60. }
  61. }, 100);
  62. },
  63. components: { MainHeader, MainFooter },
  64. }
  65. </script>
  66. <style lang="scss" scoped>
  67. .container {
  68. padding: 25px;
  69. }
  70. </style>