|
@@ -1,28 +1,17 @@
|
|
<template>
|
|
<template>
|
|
<div class="modal is-active">
|
|
<div class="modal is-active">
|
|
- <div
|
|
|
|
- class="modal-background"
|
|
|
|
- @click="
|
|
|
|
- closeModal({
|
|
|
|
- sector: 'header',
|
|
|
|
- modal: 'register'
|
|
|
|
- })
|
|
|
|
- "
|
|
|
|
- />
|
|
|
|
|
|
+ <div class="modal-background" @click="closeRegisterModal()" />
|
|
<div class="modal-card">
|
|
<div class="modal-card">
|
|
<header class="modal-card-head">
|
|
<header class="modal-card-head">
|
|
<p class="modal-card-title">Register</p>
|
|
<p class="modal-card-title">Register</p>
|
|
<button
|
|
<button
|
|
|
|
+ v-if="!isPage"
|
|
class="delete"
|
|
class="delete"
|
|
- @click="
|
|
|
|
- closeModal({
|
|
|
|
- sector: 'header',
|
|
|
|
- modal: 'register'
|
|
|
|
- })
|
|
|
|
- "
|
|
|
|
|
|
+ @click="closeRegisterModal()"
|
|
/>
|
|
/>
|
|
</header>
|
|
</header>
|
|
<section class="modal-card-body">
|
|
<section class="modal-card-body">
|
|
|
|
+ <!-- email address -->
|
|
<p class="control">
|
|
<p class="control">
|
|
<label class="label">Email</label>
|
|
<label class="label">Email</label>
|
|
<input
|
|
<input
|
|
@@ -42,6 +31,7 @@
|
|
></input-help-box>
|
|
></input-help-box>
|
|
</transition>
|
|
</transition>
|
|
|
|
|
|
|
|
+ <!-- username -->
|
|
<p class="control">
|
|
<p class="control">
|
|
<label class="label">Username</label>
|
|
<label class="label">Username</label>
|
|
<input
|
|
<input
|
|
@@ -60,17 +50,32 @@
|
|
></input-help-box>
|
|
></input-help-box>
|
|
</transition>
|
|
</transition>
|
|
|
|
|
|
|
|
+ <!-- password -->
|
|
<p class="control">
|
|
<p class="control">
|
|
<label class="label">Password</label>
|
|
<label class="label">Password</label>
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+ <div id="password-container">
|
|
<input
|
|
<input
|
|
v-model="password.value"
|
|
v-model="password.value"
|
|
class="input"
|
|
class="input"
|
|
type="password"
|
|
type="password"
|
|
|
|
+ ref="password"
|
|
placeholder="Password..."
|
|
placeholder="Password..."
|
|
@blur="onInputBlur('password')"
|
|
@blur="onInputBlur('password')"
|
|
@keypress="$parent.submitOnEnter(submitModal, $event)"
|
|
@keypress="$parent.submitOnEnter(submitModal, $event)"
|
|
/>
|
|
/>
|
|
- </p>
|
|
|
|
|
|
+ <a @click="togglePasswordVisibility()">
|
|
|
|
+ <i class="material-icons">
|
|
|
|
+ {{
|
|
|
|
+ !password.visible
|
|
|
|
+ ? "visibility"
|
|
|
|
+ : "visibility_off"
|
|
|
|
+ }}
|
|
|
|
+ </i>
|
|
|
|
+ </a>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
<transition name="fadein-helpbox">
|
|
<transition name="fadein-helpbox">
|
|
<input-help-box
|
|
<input-help-box
|
|
v-if="password.entered"
|
|
v-if="password.entered"
|
|
@@ -82,26 +87,48 @@
|
|
<br />
|
|
<br />
|
|
|
|
|
|
<p>
|
|
<p>
|
|
- By logging in/registering you agree to our
|
|
|
|
- <router-link to="/terms"> Terms of Service </router-link
|
|
|
|
- > and
|
|
|
|
- <router-link to="/privacy"> Privacy Policy </router-link>.
|
|
|
|
|
|
+ By registering you agree to our
|
|
|
|
+ <router-link
|
|
|
|
+ to="/terms"
|
|
|
|
+ @click.native="closeRegisterModal()"
|
|
|
|
+ >
|
|
|
|
+ Terms of Service
|
|
|
|
+ </router-link>
|
|
|
|
+ and
|
|
|
|
+ <router-link
|
|
|
|
+ to="/privacy"
|
|
|
|
+ @click.native="closeRegisterModal()"
|
|
|
|
+ >
|
|
|
|
+ Privacy Policy </router-link
|
|
|
|
+ >.
|
|
</p>
|
|
</p>
|
|
</section>
|
|
</section>
|
|
<footer class="modal-card-foot">
|
|
<footer class="modal-card-foot">
|
|
- <a class="button is-primary" href="#" @click="submitModal()"
|
|
|
|
- >Submit</a
|
|
|
|
- >
|
|
|
|
- <a
|
|
|
|
- class="button is-github"
|
|
|
|
- :href="apiDomain + '/auth/github/authorize'"
|
|
|
|
- @click="githubRedirect()"
|
|
|
|
- >
|
|
|
|
- <div class="icon">
|
|
|
|
- <img class="invert" src="/assets/social/github.svg" />
|
|
|
|
- </div>
|
|
|
|
- Register with GitHub
|
|
|
|
|
|
+ <router-link to="/login" v-if="isPage">
|
|
|
|
+ Already have an account?
|
|
|
|
+ </router-link>
|
|
|
|
+ <a v-else href="#" @click="changeToLoginModal()">
|
|
|
|
+ Already have an account?
|
|
</a>
|
|
</a>
|
|
|
|
+
|
|
|
|
+ <div id="actions">
|
|
|
|
+ <a
|
|
|
|
+ class="button is-github"
|
|
|
|
+ :href="apiDomain + '/auth/github/authorize'"
|
|
|
|
+ @click="githubRedirect()"
|
|
|
|
+ >
|
|
|
|
+ <div class="icon">
|
|
|
|
+ <img
|
|
|
|
+ class="invert"
|
|
|
|
+ src="/assets/social/github.svg"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ Register with GitHub
|
|
|
|
+ </a>
|
|
|
|
+ <a class="button is-primary" href="#" @click="submitModal()"
|
|
|
|
+ >Register</a
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
</footer>
|
|
</footer>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -134,6 +161,7 @@ export default {
|
|
value: "",
|
|
value: "",
|
|
valid: false,
|
|
valid: false,
|
|
entered: false,
|
|
entered: false,
|
|
|
|
+ visible: false,
|
|
message: "Please enter a valid password."
|
|
message: "Please enter a valid password."
|
|
},
|
|
},
|
|
recaptcha: {
|
|
recaptcha: {
|
|
@@ -141,7 +169,8 @@ export default {
|
|
token: "",
|
|
token: "",
|
|
enabled: false
|
|
enabled: false
|
|
},
|
|
},
|
|
- apiDomain: ""
|
|
|
|
|
|
+ apiDomain: "",
|
|
|
|
+ isPage: false
|
|
};
|
|
};
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -194,6 +223,8 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
async mounted() {
|
|
async mounted() {
|
|
|
|
+ if (this.$route.path === "/register") this.isPage = true;
|
|
|
|
+
|
|
this.apiDomain = await lofig.get("apiDomain");
|
|
this.apiDomain = await lofig.get("apiDomain");
|
|
|
|
|
|
lofig.get("recaptcha").then(obj => {
|
|
lofig.get("recaptcha").then(obj => {
|
|
@@ -221,6 +252,25 @@ export default {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ togglePasswordVisibility() {
|
|
|
|
+ if (this.$refs.password.type === "password") {
|
|
|
|
+ this.$refs.password.type = "text";
|
|
|
|
+ this.password.visible = true;
|
|
|
|
+ } else {
|
|
|
|
+ this.$refs.password.type = "password";
|
|
|
|
+ this.password.visible = false;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ changeToLoginModal() {
|
|
|
|
+ if (!this.isPage) {
|
|
|
|
+ this.closeRegisterModal();
|
|
|
|
+ this.openModal({ sector: "header", modal: "login" });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ closeRegisterModal() {
|
|
|
|
+ if (!this.isPage)
|
|
|
|
+ this.closeModal({ sector: "header", modal: "login" });
|
|
|
|
+ },
|
|
submitModal() {
|
|
submitModal() {
|
|
if (
|
|
if (
|
|
!this.username.valid ||
|
|
!this.username.valid ||
|
|
@@ -246,7 +296,7 @@ export default {
|
|
githubRedirect() {
|
|
githubRedirect() {
|
|
localStorage.setItem("github_redirect", this.$route.path);
|
|
localStorage.setItem("github_redirect", this.$route.path);
|
|
},
|
|
},
|
|
- ...mapActions("modalVisibility", ["closeModal"]),
|
|
|
|
|
|
+ ...mapActions("modalVisibility", ["closeModal", "openModal"]),
|
|
...mapActions("user/auth", ["register"])
|
|
...mapActions("user/auth", ["register"])
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -267,6 +317,25 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+#password-container {
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+
|
|
|
|
+ a {
|
|
|
|
+ width: 0;
|
|
|
|
+ margin-left: -30px;
|
|
|
|
+ z-index: 0;
|
|
|
|
+ top: 2px;
|
|
|
|
+ position: relative;
|
|
|
|
+ color: var(--light-grey-1);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.modal-card-foot {
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: space-between;
|
|
|
|
+}
|
|
|
|
+
|
|
.button.is-github {
|
|
.button.is-github {
|
|
background-color: var(--dark-grey-2);
|
|
background-color: var(--dark-grey-2);
|
|
color: var(--white) !important;
|
|
color: var(--white) !important;
|