Register.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <div class="modal is-active">
  3. <div class="modal-background"></div>
  4. <div class="modal-card">
  5. <header class="modal-card-head">
  6. <p class="modal-card-title">Register</p>
  7. <button class="delete" v-on:click="closeCurrentModal()"></button>
  8. </header>
  9. <section class="modal-card-body">
  10. <!-- validation to check if exists http://bulma.io/documentation/elements/form/ -->
  11. <label class="label">Email</label>
  12. <p class="control">
  13. <input
  14. class="input"
  15. type="text"
  16. placeholder="Email..."
  17. v-model="$parent.register.email"
  18. autofocus
  19. />
  20. </p>
  21. <label class="label">Username</label>
  22. <p class="control">
  23. <input
  24. class="input"
  25. type="text"
  26. placeholder="Username..."
  27. v-model="$parent.register.username"
  28. />
  29. </p>
  30. <label class="label">Password</label>
  31. <p class="control">
  32. <input
  33. class="input"
  34. type="password"
  35. placeholder="Password..."
  36. v-model="$parent.register.password"
  37. v-on:keypress="$parent.submitOnEnter(submitModal, $event)"
  38. />
  39. </p>
  40. <div id="recaptcha"></div>
  41. <p>
  42. By logging in/registering you agree to our
  43. <router-link to="/terms">Terms of Service</router-link>and
  44. <router-link to="/privacy">Privacy Policy</router-link>.
  45. </p>
  46. </section>
  47. <footer class="modal-card-foot">
  48. <a class="button is-primary" href="#" v-on:click="submitModal()">Submit</a>
  49. <a
  50. class="button is-github"
  51. :href="$parent.serverDomain + '/auth/github/authorize'"
  52. v-on:click="githubRedirect()"
  53. >
  54. <div class="icon">
  55. <img class="invert" src="/assets/social/github.svg" />
  56. </div>&nbsp;&nbsp;Register with GitHub
  57. </a>
  58. </footer>
  59. </div>
  60. </div>
  61. </template>
  62. <script>
  63. import { mapActions } from "vuex";
  64. export default {
  65. data() {
  66. return {
  67. recaptcha: {
  68. key: ""
  69. }
  70. };
  71. },
  72. mounted: function() {
  73. let _this = this;
  74. lofig.get("recaptcha", obj => {
  75. _this.recaptcha.key = obj.key;
  76. _this.recaptcha.id = grecaptcha.render("recaptcha", {
  77. sitekey: _this.recaptcha.key
  78. });
  79. });
  80. },
  81. methods: {
  82. submitModal: function() {
  83. // this.$dispatch('register', this.recaptcha.id);
  84. this.toggleModal();
  85. },
  86. githubRedirect: function() {
  87. localStorage.setItem("github_redirect", this.$route.path);
  88. },
  89. ...mapActions("modals", ["toggleModal", "closeCurrentModal"])
  90. }
  91. };
  92. </script>
  93. <style lang='scss' scoped>
  94. .button.is-github {
  95. background-color: #333;
  96. color: #fff !important;
  97. }
  98. .is-github:focus {
  99. background-color: #1a1a1a;
  100. }
  101. .is-primary:focus {
  102. background-color: #028bca !important;
  103. }
  104. .invert {
  105. filter: brightness(5);
  106. }
  107. #recaptcha {
  108. padding: 10px 0;
  109. }
  110. a {
  111. color: #029ce3;
  112. }
  113. </style>