Skip to content
Snippets Groups Projects
Commit 9123cb62 authored by raghosh's avatar raghosh
Browse files

#75: font size of menu increased.

parent 743f9847
No related branches found
No related tags found
No related merge requests found
......@@ -12,9 +12,7 @@
mb-3
"
>
<div class="text-right px-8 w-full">
Last updated: 30-06-2022
</div>
<div class="text-right px-8 w-full">Last updated: 30-06-2022</div>
<div class="px-4 flex mb-2 flex-wrap w-full items-center justify-between">
<div class="ml-4">
<a href="/">
......@@ -22,7 +20,7 @@
alt="logo"
class="w-36 object-contain rounded-lg"
src="@/assets/cd-code-logo.png"
>
/>
</a>
</div>
<div class="flex items-center space-x-4">
......@@ -39,11 +37,12 @@
py-4
flex
items-center
text-3xl
font-medium
text-4xl
font-semibold
hover:text-pink-base
"
>Home</span>
>Home</span
>
</router-link>
<router-link
......@@ -59,10 +58,11 @@
flex
items-center
hover:text-pink-base
text-3xl
font-medium
text-4xl
font-semibold
"
>About</span>
>About</span
>
</router-link>
<router-link
......@@ -78,11 +78,12 @@
flex
items-center
hover:text-pink-base
text-3xl
font-medium
text-4xl
font-semibold
leading-snug
"
>Proteins</span>
>Proteins</span
>
</router-link>
<div class="relative rounded-lg">
<router-link
......@@ -104,11 +105,12 @@
flex
items-center
hover:text-pink-base
text-3xl
font-medium
text-4xl
font-semibold
leading-snug
"
>Condensates</span>
>Condensates</span
>
</router-link>
<div
v-if="openCondensateSubMenu"
......@@ -127,10 +129,7 @@
@mouseleave="openCondensateSubMenu = false"
>
<div>
<router-link
to="/biomolecular"
class="rounded-lg"
>
<router-link to="/biomolecular" class="rounded-lg">
<span
class="
px-4
......@@ -140,21 +139,19 @@
text-black
hover:text-pink-base
items-center
text-3xl
font-medium
text-4xl
font-semibold
"
:class="
$route.name === 'biomolecular' ? 'text-pink-base' : ''
"
>
Biomolecular Condensates</span>
Biomolecular Condensates</span
>
</router-link>
</div>
<div>
<router-link
to="/synthetic"
class="rounded-lg"
>
<router-link to="/synthetic" class="rounded-lg">
<span
class="
px-4
......@@ -163,11 +160,12 @@
hover:text-pink-base
flex
items-center
text-3xl
font-medium
text-4xl
font-semibold
"
:class="$route.name === 'synthetic' ? 'text-pink-base' : ''"
>Synthetic Condensates</span>
>Synthetic Condensates</span
>
</router-link>
</div>
......@@ -176,7 +174,7 @@
<router-link
v-if="
userRole !== null &&
(userRole === 'Maintainer' || userRole === 'Contributor')
(userRole === 'Maintainer' || userRole === 'Contributor')
"
to="/addCondensate"
class="rounded-lg"
......@@ -190,13 +188,14 @@
hover:text-pink-base
flex
items-center
text-3xl
font-medium
text-4xl
font-semibold
"
:class="
$route.name === 'addCondensate' ? 'text-pink-base' : ''
"
>Add New Condensate</span>
>Add New Condensate</span
>
</router-link>
</div>
</div>
......@@ -215,10 +214,11 @@
hover:text-pink-base
flex
items-center
text-3xl
font-medium
text-4xl
font-semibold
"
>Statistics</span>
>Statistics</span
>
</router-link>
<a
......@@ -234,10 +234,11 @@
hover:text-pink-base
flex
items-center
text-3xl
font-medium
text-4xl
font-semibold
"
>Encyclopedia</span>
>Encyclopedia</span
>
</a>
<router-link
......@@ -253,10 +254,11 @@
hover:text-pink-base
flex
items-center
text-3xl
font-medium
text-4xl
font-semibold
"
>Help</span>
>Help</span
>
</router-link>
</div>
......@@ -282,7 +284,8 @@
text-3xl
font-medium
"
>Sign in</span>
>Sign in</span
>
</router-link>
<router-link
v-if="userData === null"
......@@ -304,7 +307,8 @@
text-3xl
font-medium
"
>Sign up</span>
>Sign up</span
>
</router-link>
</div>
......@@ -416,14 +420,15 @@
text-2xl
font-medium
"
>Profile</span>
>Profile</span
>
</router-link>
</div>
<div>
<router-link
v-show="
userData !== null &&
(userRole === 'Contributor' || userRole === 'Maintainer')
(userRole === 'Contributor' || userRole === 'Maintainer')
"
to="/updateItems"
role="presentation"
......@@ -470,7 +475,8 @@
text-2xl
font-medium
"
>All Submitted Condensates</span>
>All Submitted Condensates</span
>
</router-link>
</div>
<div>
......@@ -493,7 +499,8 @@
text-2xl
font-medium
"
>Logout</span>
>Logout</span
>
</router-link>
</div>
</div>
......@@ -514,7 +521,7 @@ export default {
},
computed: {
userData: function () {
return this.$store.getters['User/userData'];
return this.$store.getters["User/userData"];
},
userName() {
const data = this.parsingUserData();
......@@ -530,7 +537,7 @@ export default {
return initials;
},
userRole: function () {
return this.$store.getters['User/userRole'];
return this.$store.getters["User/userRole"];
},
},
mounted: function () {
......@@ -544,12 +551,12 @@ export default {
},
methods: {
parsingUserData() {
const data = this.$store.getters['User/userData'];
const data = this.$store.getters["User/userData"];
let parsedData = JSON.parse(data);
return parsedData;
},
getInitials(string) {
var names = string.split(' '),
var names = string.split(" "),
initials = names[0].substring(0, 1).toUpperCase();
if (names.length > 1) {
......@@ -565,11 +572,11 @@ export default {
},
signOut() {
const vm = this;
window.localStorage.removeItem('jwt');
window.localStorage.removeItem('userData');
window.localStorage.removeItem('roleName');
vm.$store.dispatch('User/logOut');
vm.$router.push('/login');
window.localStorage.removeItem("jwt");
window.localStorage.removeItem("userData");
window.localStorage.removeItem("roleName");
vm.$store.dispatch("User/logOut");
vm.$router.push("/login");
},
},
};
......
<template>
<div>
<base-toaster
:open="toasterIsOpen"
@close="hideDialog"
>
<base-toaster :open="toasterIsOpen" @close="hideDialog">
<div class="flex justify-between space-x-4 items-center">
<font-awesome-icon
class="ml-3"
......@@ -12,19 +9,23 @@
/>
<h4>Password reset link has been sent to {{ email.val }}.</h4>
<button
class="btn btn-outline"
@click="hideDialog"
>
<font-awesome-icon
icon="fa-regular fa-circle-xmark"
size="2x"
/>
<button class="btn btn-outline" @click="hideDialog">
<font-awesome-icon icon="fa-regular fa-circle-xmark" size="2x" />
</button>
</div>
</base-toaster>
<div class="flex items-center justify-center">
<div class="sm:block border border-gray-300 rounded-lg mt-6 w-1/3">
<div
class="
sm:block
border
bg-white bg-opacity-80
border-gray-300
rounded-lg
mt-6
w-1/3
"
>
<div class="p-5 mx-auto text-left">
<h1
class="
......@@ -79,21 +80,15 @@
"
placeholder="Enter email address."
@blur="clearValidity('email')"
>
<p
v-if="!email.isValid"
class="text-red-500 mt-2"
>
/>
<p v-if="!email.isValid" class="text-red-500 mt-2">
Email must not be empty.
</p>
<p
v-show="error"
class="mt-2 text-red-500"
>
<p v-show="error" class="mt-2 text-red-500">
{{ errorMsg }}
</p>
</div>
<button
type="submit"
class="
......@@ -116,27 +111,27 @@
</div>
</template>
<script>
import BaseSpinner from '../components/UI/BaseSpinner.vue';
import BaseToaster from '../components/UI/BaseToaster.vue';
let host = require('@/components/js/const').apiHost;
import BaseSpinner from "../components/UI/BaseSpinner.vue";
import BaseToaster from "../components/UI/BaseToaster.vue";
let host = require("@/components/js/const").apiHost;
export default {
name: 'ForgotPassword',
name: "ForgotPassword",
components: { BaseSpinner, BaseToaster },
data() {
return {
email: {
val: '',
val: "",
isValid: true,
},
formIsValid: true,
done: false,
error: false,
isDev: process.env.NODE_ENV === 'development',
isDev: process.env.NODE_ENV === "development",
isLoading: false,
toasterIsOpen: false,
errorMsg: '',
errorMsg: "",
};
},
methods: {
......@@ -145,14 +140,14 @@ export default {
},
hideDialog() {
this.toasterIsOpen = false;
this.$router.push('login');
this.$router.push("login");
},
clearValidity(input) {
this[input].isValid = true;
},
validateForm() {
this.formIsValid = true;
if (this.email.val === '') {
if (this.email.val === "") {
this.email.isValid = false;
this.formIsValid = false;
}
......@@ -168,7 +163,7 @@ export default {
}
if (vm.isDev) {
host = require('@/components/js/const').devApiHost;
host = require("@/components/js/const").devApiHost;
}
this.isLoading = true;
this.done = false;
......@@ -176,65 +171,64 @@ export default {
// const res= this.axios.post(`${host}/api/auth/forgot-password`, {
// email: this.email.val
// })
try{
const res = await fetch(`${host}/api/auth/forgot-password`, {
method: 'POST',
mode: 'cors', // no-cors, *cors, same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache,
headers: {
'Content-Type': 'application/json',
// 'Content-Type': 'application/x-www-form-urlencoded',
},
body: JSON.stringify({
email: this.email.val,
}),
});
if(!res.ok){
this.isLoading = false;
this.error = true;
this.errorMsg = `${res.status} Internal Error, please write a mail to CDCode Admin`;
try {
const res = await fetch(`${host}/api/auth/forgot-password`, {
method: "POST",
mode: "cors", // no-cors, *cors, same-origin
cache: "no-cache", // *default, no-cache, reload, force-cache,
headers: {
"Content-Type": "application/json",
// 'Content-Type': 'application/x-www-form-urlencoded',
},
body: JSON.stringify({
email: this.email.val,
}),
});
if (!res.ok) {
this.isLoading = false;
this.error = true;
this.errorMsg = `${res.status} Internal Error, please write a mail to CDCode Admin`;
return;
}
if (!res.ok && res.status === 500) {
this.isLoading = false;
this.error = true;
this.errorMsg = `${res.status} Internal Error, please write a mail to CDCode Admin`;
return;
}
if (!res.ok && res.status === 500) {
this.isLoading = false;
this.error = true;
this.errorMsg = `${res.status} Internal Error, please write a mail to CDCode Admin`;
return;
}
if (!res.ok && res.status === 405) {
this.isLoading = false;
this.error = true;
this.errorMsg = `${res.status} Internal Error, please write a mail to CDCode Admin`;
return;
}
if (!res.ok && res.status === 405) {
this.isLoading = false;
this.error = true;
this.errorMsg = `${res.status} Internal Error, please write a mail to CDCode Admin`;
return;
}
const response = await res.json();
return;
}
const response = await res.json();
if (
!res.ok &&
response.error.status === 400 &&
response.error.message === 'This email does not exist'
) {
this.isLoading = false;
this.error = true;
this.errorMsg =
'Provided email address is not yet registered with any existing account (User has not signed up yet)';
if (
!res.ok &&
response.error.status === 400 &&
response.error.message === "This email does not exist"
) {
this.isLoading = false;
this.error = true;
this.errorMsg =
"Provided email address is not yet registered with any existing account (User has not signed up yet)";
return;
}
return;
}
this.isLoading = false;
this.error= false;
this.toasterIsOpen = true;
}catch(err){
console.log(err);
this.isLoading = false;
this.isLoading = false;
this.error = false;
this.toasterIsOpen = true;
} catch (err) {
console.log(err);
this.isLoading = false;
this.error = true;
this.errorMsg = `Internal Error, please write a mail to CDCode Admin`;
}
}
},
},
};
......
......@@ -4,7 +4,16 @@
<base-spinner />
</div>
<div class="flex items-center justify-center">
<div class="sm:block border border-gray-300 rounded-lg mt-6 w-1/3">
<div
class="
sm:block
border border-gray-300
bg-white bg-opacity-60
rounded-lg
mt-6
w-1/3
"
>
<div class="p-5 mx-auto text-left font-raleway">
<h1
class="
......@@ -20,10 +29,7 @@
</h1>
<form @submit="login">
<div
class="my-4"
:class="{ invalid: !email.isValid }"
>
<div class="my-4" :class="{ invalid: !email.isValid }">
<h1
class="
text-left
......@@ -52,18 +58,12 @@
"
placeholder="Enter email."
@blur="clearValidity('email')"
>
<p
v-if="!email.isValid"
class="text-red-500"
>
/>
<p v-if="!email.isValid" class="text-red-500">
Email must not be empty.
</p>
</div>
<div
class="my-4"
:class="{ invalid: !password.isValid }"
>
<div class="my-4" :class="{ invalid: !password.isValid }">
<h1
class="
text-left
......@@ -93,18 +93,12 @@
"
placeholder="Enter password."
@blur="clearValidity('password')"
>
<p
v-if="!password.isValid"
class="text-red-500"
>
/>
<p v-if="!password.isValid" class="text-red-500">
Password must not be empty.
</p>
</div>
<p
v-show="error"
class="text-red-500"
>
<p v-show="error" class="text-red-500">
{{ errorMsg }}
</p>
<button
......@@ -146,37 +140,37 @@
</div>
</template>
<script>
let host = require('@/components/js/const').apiHost;
let host = require("@/components/js/const").apiHost;
export default {
name: 'Login',
name: "Login",
data() {
return {
email: {
val: '',
val: "",
isValid: true,
},
password: {
val: '',
val: "",
isValid: true,
},
formIsValid: true,
error: false,
errorMsg: ``,
isDev: process.env.NODE_ENV === 'development',
isDev: process.env.NODE_ENV === "development",
isLoading: false,
};
},
computed: {
userData: function () {
return this.$store.getters['User/userData'];
return this.$store.getters["User/userData"];
},
},
mounted: function () {
const vm = this;
if (vm.userData !== null) {
this.$router.push('/profile');
this.$router.push("/profile");
}
},
methods: {
......@@ -185,11 +179,11 @@ export default {
},
validateForm() {
this.formIsValid = true;
if (this.email.val === '') {
if (this.email.val === "") {
this.email.isValid = false;
this.formIsValid = false;
}
if (this.password.val === '') {
if (this.password.val === "") {
this.password.isValid = false;
this.formIsValid = false;
}
......@@ -203,17 +197,17 @@ export default {
return;
}
if (vm.isDev) {
host = require('@/components/js/const').devApiHost;
host = require("@/components/js/const").devApiHost;
}
console.log('url is', host);
console.log("url is", host);
this.isLoading = true;
try {
const res = await fetch(`${host}/api/auth/local`, {
method: 'POST',
mode: 'cors', // no-cors, *cors, same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache,
method: "POST",
mode: "cors", // no-cors, *cors, same-origin
cache: "no-cache", // *default, no-cache, reload, force-cache,
headers: {
'Content-Type': 'application/json',
"Content-Type": "application/json",
// 'Content-Type': 'application/x-www-form-urlencoded',
},
body: JSON.stringify({
......@@ -249,27 +243,27 @@ export default {
if (
!res.ok &&
response.error.status === 400 &&
response.error.message === 'Invalid identifier or password'
response.error.message === "Invalid identifier or password"
) {
this.isLoading = false;
this.error = true;
this.errorMsg = 'Email Address & Password mismatch.';
this.password.val = '';
this.errorMsg = "Email Address & Password mismatch.";
this.password.val = "";
return;
}
const { jwt, user } = response;
window.localStorage.setItem('jwt', jwt);
window.localStorage.setItem('userData', JSON.stringify(user));
window.localStorage.setItem("jwt", jwt);
window.localStorage.setItem("userData", JSON.stringify(user));
this.$store.dispatch('User/setJwt', jwt);
this.$store.dispatch('User/setUserData', JSON.stringify(user));
this.$store.dispatch("User/setJwt", jwt);
this.$store.dispatch("User/setUserData", JSON.stringify(user));
this.isLoading = false;
this.error = false;
this.$router.push('/profile');
this.$router.push("/profile");
} catch (err) {
console.log('catch error', err);
console.log("catch error", err);
this.isLoading = false;
this.error = true;
this.errorMsg = `${err.message} Internal Error, please write a mail to CDCode Admin`;
......
<template>
<div class="mb-14">
<base-toaster
:open="toasterIsOpen"
@close="hideDialog"
>
<base-toaster :open="toasterIsOpen" @close="hideDialog">
<div class="flex justify-between space-x-4 items-center">
<font-awesome-icon
class="ml-3"
......@@ -17,14 +14,8 @@
. Please click the link to activate your account.
</h4>
<button
class="btn btn-outline"
@click="hideDialog"
>
<font-awesome-icon
icon="fa-regular fa-circle-xmark"
size="2x"
/>
<button class="btn btn-outline" @click="hideDialog">
<font-awesome-icon icon="fa-regular fa-circle-xmark" size="2x" />
</button>
</div>
</base-toaster>
......@@ -33,6 +24,7 @@
class="
sm:block
border border-gray-300
bg-white bg-opacity-75
rounded-lg
w-2/5
mt-6
......@@ -55,10 +47,7 @@
</h1>
<form @submit.prevent="register">
<div
class="my-4"
:class="{ invalid: !name.isValid }"
>
<div class="my-4" :class="{ invalid: !name.isValid }">
<div class="flex justify-between">
<h1
class="
......@@ -103,18 +92,12 @@
"
placeholder="Enter full name."
@blur="clearValidity('name')"
>
<p
v-if="!name.isValid"
class="text-red-500"
>
/>
<p v-if="!name.isValid" class="text-red-500">
Name must not be empty.
</p>
</div>
<div
class="my-4"
:class="{ invalid: !email.isValid }"
>
<div class="my-4" :class="{ invalid: !email.isValid }">
<h1
class="
text-left
......@@ -144,24 +127,15 @@
"
placeholder="Enter email."
@blur="clearValidity('email')"
>
<p
v-if="!email.isValid"
class="text-red-500"
>
/>
<p v-if="!email.isValid" class="text-red-500">
Email must not be empty.
</p>
<p
v-if="error && errorMsg"
class="text-red-500"
>
<p v-if="error && errorMsg" class="text-red-500">
{{ errorMsg }}
</p>
</div>
<div
class="my-4"
:class="{ invalid: !password.isValid }"
>
<div class="my-4" :class="{ invalid: !password.isValid }">
<h1
class="
text-left
......@@ -191,18 +165,12 @@
"
placeholder="Password must be minimum 6 character."
@blur="clearValidity('password')"
>
<p
v-if="!password.isValid"
class="text-red-500"
>
/>
<p v-if="!password.isValid" class="text-red-500">
Password must not be empty or less than 6 character.
</p>
</div>
<div
class="my-4"
:class="{ invalid: !username.isValid }"
>
<div class="my-4" :class="{ invalid: !username.isValid }">
<h1
class="
text-left
......@@ -233,18 +201,12 @@
"
placeholder="Username must be minimum 3 character."
@blur="clearValidity('username')"
>
<p
v-if="!username.isValid"
class="text-red-500"
>
/>
<p v-if="!username.isValid" class="text-red-500">
Username must not be empty.
</p>
</div>
<div
class="my-4"
:class="{ invalid: !current_role.isValid }"
>
<div class="my-4" :class="{ invalid: !current_role.isValid }">
<h1
class="
text-left
......@@ -276,22 +238,9 @@
"
@blur="clearValidity('current_role')"
>
<option
id="phd"
value="PhD"
>
PhD
</option>
<option
id="postdoc"
value="PostDoc"
>
PostDoc
</option>
<option
id="research_scientist"
value="Research_Scientist"
>
<option id="phd" value="PhD">PhD</option>
<option id="postdoc" value="PostDoc">PostDoc</option>
<option id="research_scientist" value="Research_Scientist">
Research Scientist
</option>
<option
......@@ -301,10 +250,7 @@
Principal Investigator
</option>
</select>
<p
v-if="!current_role.isValid"
class="text-red-500"
>
<p v-if="!current_role.isValid" class="text-red-500">
Select a current role.
</p>
</div>
......@@ -336,25 +282,16 @@
:name="options"
:value="options.discipline"
@blur="clearValidity('scientific_discipline')"
>
<label
class="mx-3"
:for="options.id"
>{{
/>
<label class="mx-3" :for="options.id">{{
options.discipline
}}</label>
</div>
<p
v-if="!scientific_discipline.isValid"
class="text-red-500"
>
<p v-if="!scientific_discipline.isValid" class="text-red-500">
Please select atleast one scientific discipline.
</p>
</div>
<div
class="my-4"
:class="{ invalid: !affiliation.isValid }"
>
<div class="my-4" :class="{ invalid: !affiliation.isValid }">
<h1
class="
text-left
......@@ -384,18 +321,12 @@
"
placeholder="Institute name currently associated with."
@blur="clearValidity('affiliation')"
>
<p
v-if="!affiliation.isValid"
class="text-red-500"
>
/>
<p v-if="!affiliation.isValid" class="text-red-500">
Affiliation must not be empty.
</p>
</div>
<div
class="my-4"
:class="{ invalid: !profileLink.isValid }"
>
<div class="my-4" :class="{ invalid: !profileLink.isValid }">
<h1
class="
text-left
......@@ -425,11 +356,8 @@
"
placeholder="eg- https://www.google.com (optional)"
@blur="clearValidity('profileLink')"
>
<p
v-if="!profileLink.isValid"
class="text-red-500"
>
/>
<p v-if="!profileLink.isValid" class="text-red-500">
The url entered is invalid. Please check it again!
</p>
<p
......@@ -439,10 +367,7 @@
{{ profileLinkErrMsg }}
</p>
</div>
<div
class="my-4"
:class="{ invalid: !motivation.isValid }"
>
<div class="my-4" :class="{ invalid: !motivation.isValid }">
<h1
class="
text-left
......@@ -475,22 +400,13 @@
@blur="clearValidity('motivation')"
/>
</div>
<p
v-if="!motivation.isValid"
class="text-red-500"
>
<p v-if="!motivation.isValid" class="text-red-500">
Motivation text must not be empty.
</p>
<p
v-if="!formIsValid"
class="font-bold text-red-400"
>
<p v-if="!formIsValid" class="font-bold text-red-400">
Required fields were not provided.
</p>
<p
v-show="error"
class="text-red-500"
>
<p v-show="error" class="text-red-500">
{{ errorMsg }}
</p>
<div v-if="isLoading">
......@@ -520,7 +436,8 @@
<a
class="text-pink-base hover:text-pink-base hover:no-underline"
@click="$router.go(-1)"
>Sign in</a>
>Sign in</a
>
</h4>
</div>
</form>
......@@ -530,45 +447,45 @@
</div>
</template>
<script>
import BaseSpinner from '../components/UI/BaseSpinner.vue';
import BaseToaster from '../components/UI/BaseToaster.vue';
let host = require('@/components/js/const').apiHost;
import BaseSpinner from "../components/UI/BaseSpinner.vue";
import BaseToaster from "../components/UI/BaseToaster.vue";
let host = require("@/components/js/const").apiHost;
export default {
name: 'Register',
name: "Register",
components: { BaseToaster, BaseSpinner },
data() {
return {
name: {
val: '',
val: "",
isValid: true,
},
email: {
val: '',
val: "",
isValid: true,
},
password: {
val: '',
val: "",
isValid: true,
},
username: {
val: '',
val: "",
isValid: true,
},
motivation: {
val: '',
val: "",
isValid: true,
},
affiliation: {
val: '',
val: "",
isValid: true,
},
current_role: {
val: '',
val: "",
isValid: true,
},
profileLink: {
val: '',
val: "",
isValid: true,
},
scientific_discipline: {
......@@ -578,17 +495,17 @@ export default {
formIsValid: true,
error: false,
errorMsg: ``,
isDev: process.env.NODE_ENV === 'development',
isDev: process.env.NODE_ENV === "development",
toasterIsOpen: false,
scientificDisciplineOptions: [
{ id: '1', discipline: 'Physics' },
{ id: '2', discipline: 'Chemistry' },
{ id: '3', discipline: 'Biology' },
{ id: '4', discipline: 'Computer Science' },
{ id: '5', discipline: 'Mathematics' },
{ id: "1", discipline: "Physics" },
{ id: "2", discipline: "Chemistry" },
{ id: "3", discipline: "Biology" },
{ id: "4", discipline: "Computer Science" },
{ id: "5", discipline: "Mathematics" },
],
profileLinkError: false,
profileLinkErrMsg: '',
profileLinkErrMsg: "",
selected: [],
isLoading: false,
};
......@@ -600,23 +517,23 @@ export default {
},
validateForm() {
this.formIsValid = true;
if (this.name.val === '') {
if (this.name.val === "") {
this.name.isValid = false;
this.formIsValid = false;
}
if (this.email.val === '') {
if (this.email.val === "") {
this.email.isValid = false;
this.formIsValid = false;
}
if (this.password.val === '' || this.password.val.length < 6) {
if (this.password.val === "" || this.password.val.length < 6) {
this.password.isValid = false;
this.formIsValid = false;
}
if (this.username.val === '' || this.username.val.length < 3) {
if (this.username.val === "" || this.username.val.length < 3) {
this.username.isValid = false;
this.formIsValid = false;
}
if (this.current_role.val === '') {
if (this.current_role.val === "") {
this.current_role.isValid = false;
this.formIsValid = false;
}
......@@ -624,7 +541,7 @@ export default {
this.scientific_discipline.isValid = false;
this.formIsValid = false;
}
if (this.affiliation.val === '') {
if (this.affiliation.val === "") {
this.affiliation.isValid = false;
this.formIsValid = false;
}
......@@ -632,7 +549,7 @@ export default {
this.profileLink.isValid = false;
this.formIsValid = false;
}
if (this.motivation.val === '') {
if (this.motivation.val === "") {
this.motivation.isValid = false;
this.formIsValid = false;
}
......@@ -640,21 +557,21 @@ export default {
isValidHttpUrl() {
let timer = null;
let pattern = new RegExp(
'^(https?:\\/\\/)?' + // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
'(\\#[-a-z\\d_]*)?$',
'i'
"^(https?:\\/\\/)?" + // protocol
"((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|" + // domain name
"((\\d{1,3}\\.){3}\\d{1,3}))" + // OR ip (v4) address
"(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + // port and path
"(\\?[;&a-z\\d%_.~+=-]*)?" + // query string
"(\\#[-a-z\\d_]*)?$",
"i"
); // fragment locator
let isValid;
if (this.profileLink.val === '') {
console.log('profile link empty');
if (this.profileLink.val === "") {
console.log("profile link empty");
return true;
} else {
isValid = pattern.test(this.profileLink.val);
console.log('lint is there', isValid);
console.log("lint is there", isValid);
}
return isValid;
// if(!isValid){
......@@ -684,7 +601,7 @@ export default {
},
hideDialog() {
this.toasterIsOpen = false;
this.$router.push('login');
this.$router.push("login");
},
async register(e) {
const vm = this;
......@@ -695,15 +612,15 @@ export default {
}
if (vm.isDev) {
host = require('@/components/js/const').devApiHost;
host = require("@/components/js/const").devApiHost;
}
this.isLoading = true;
const res = await fetch(`${host}/api/auth/local/register`, {
method: 'POST',
mode: 'cors', // no-cors, *cors, same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache,
method: "POST",
mode: "cors", // no-cors, *cors, same-origin
cache: "no-cache", // *default, no-cache, reload, force-cache,
headers: {
'Content-Type': 'application/json',
"Content-Type": "application/json",
// 'Content-Type': 'application/x-www-form-urlencoded',
},
body: JSON.stringify({
......@@ -736,19 +653,19 @@ export default {
if (
!res.ok &&
response.error.status === 400 &&
response.error.message === 'Email is already taken'
response.error.message === "Email is already taken"
) {
this.isLoading = false;
this.error = true;
this.errorMsg =
'Email Address already registered with an existing account. You can reset your password by clicking forget password from sign up page.';
this.password.val = '';
"Email Address already registered with an existing account. You can reset your password by clicking forget password from sign up page.";
this.password.val = "";
return;
}
this.isLoading = false;
vm.toasterIsOpen = true;
this.error = false;
this.errorMsg = '';
this.errorMsg = "";
// try {
// await vm.axios.post(`${host}/api/auth/local/register`, {
// full_name: vm.name.val,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment