refactor(gui): linting

Signed-off-by: Pranav C <61551451+pranavxc@users.noreply.github.com>
This commit is contained in:
Pranav C
2021-07-19 16:30:37 +05:30
parent f9508c2d44
commit fa00be39b8
303 changed files with 34924 additions and 31761 deletions

View File

@@ -1,12 +1,14 @@
<template>
<div class="h-100 w-100 d-flex align-center justify-center">
<v-icon size="60">mdi-spin mdi-loading</v-icon>
<v-icon size="60">
mdi-spin mdi-loading
</v-icon>
</div>
</template>
<script>
export default {
name: "callback"
name: 'Callback'
}
</script>

View File

@@ -5,30 +5,30 @@
</template>
<script>
export default {
data() {
return {
export default {
directives: { },
components: { },
validate ({ params }) { return true },
props: { },
data () {
return {
}
},
computed : {
}
},
head () { return {} },
computed: {
},
methods : {
},
watch: { },
created () { },
mounted () {},
beforeDestroy () {},
methods: {
},
beforeCreated () {},
created () { },
mounted () {},
beforeDestroy () {},
destroy () {},
validate({params}) { return true },
head() { return {} },
props: { },
watch: { },
directives : { },
components : { }
}
},
beforeCreated () {},
destroy () {}
}
</script>
<style scoped>

View File

@@ -21,48 +21,48 @@
width="90"
height="90"
:src="require('~/assets/img/icons/512x512-trans.png')"
>
</v-img>
/>
</div>
<!-- SIGN IN -->
<h1 class="mt-4">{{ $t('signin.title') }}</h1>
<h1 class="mt-4">
{{ $t('signin.title') }}
</h1>
<div>
<v-alert type="error" dismissible v-model="formUtil.formErr">
<v-alert v-model="formUtil.formErr" type="error" dismissible>
{{ formUtil.formErrMsg }}
</v-alert>
</div>
<v-form
v-if="type === 'jwt'"
v-model="valid"
ref="formType"
v-model="valid"
lazy-validation
>
<!-- Enter your work email -->
<v-text-field
v-bind:label="$t('signin.enter_your_work_email')"
v-model="form.email"
:label="$t('signin.enter_your_work_email')"
:rules="formRules.email"
required
>
</v-text-field>
/>
<!-- Enter your password -->
<v-text-field
v-model="form.password"
name="input-10-2"
v-bind:label="$t('signin.enter_your_password')"
:label="$t('signin.enter_your_password')"
min="8"
:append-icon="e3 ? 'visibility' : 'visibility_off'"
@click:append="() => (e3 = !e3)"
v-model="form.password"
:rules="formRules.password"
:type="e3 ? 'password' : 'text'"
>
</v-text-field>
@click:append="() => (e3 = !e3)"
/>
<!-- Forgot your password -->
<p class="accent--text text-right caption font-weight-light">
<router-link to="/user/password/forgot">{{
<router-link to="/user/password/forgot">
{{
$t('signin.forget_password')
}}
</router-link>
@@ -78,26 +78,26 @@
<!-- </v-btn>-->
<v-btn
@click="MtdOnSignin"
v-ge="['Sign In', '']"
color="primary"
large
elevation-10
:disabled="false"
v-ge="['Sign In', '']"
@click="MtdOnSignin"
>
<b>{{ $t('signin.title') }}</b>
</v-btn>
<br/>
<br/>
<br/>
<br>
<br>
<br>
<!-- Don't have an account ? -->
<p class="caption font-weight-light">
{{ $t('signin.dont_ve_an_account') }}
<!-- Sign Up -->
<router-link
to="/user/authentication/signup"
v-ge="['Don\'t have an account ?', '']"
to="/user/authentication/signup"
>
{{ $t('signin.sign_up') }}
</router-link>
@@ -117,7 +117,7 @@
class="img-responsive"
alt="google"
width="24px"
/>
>
<b>&nbsp; &nbsp;Sign In with Google</b>
</v-btn>
<v-btn
@@ -134,7 +134,7 @@
class="img-responsive"
alt="github"
width="24px"
/>
>
<b>&nbsp; &nbsp;Sign In with Github</b>
</v-btn>
@@ -156,22 +156,21 @@
<v-form
v-else-if="type === 'masterKey'"
v-model="formUtil.valid1"
ref="formType1"
@submit="MtdOnSignup"
v-model="formUtil.valid1"
elevation-20
@submit="MtdOnSignup"
>
<v-text-field
label="Admin Secret"
v-model="form.secret"
label="Admin Secret"
:rules="formRules.secret"
min="8"
:append-icon="formUtil.e4 ? 'visibility' : 'visibility_off'"
@click:append="() => (formUtil.e4 = !formUtil.e4)"
:type="formUtil.e4 ? 'password' : 'text'"
required
>
</v-text-field>
@click:append="() => (formUtil.e4 = !formUtil.e4)"
/>
<!---->
@@ -181,18 +180,18 @@
<!-- </vue-recaptcha>-->
<v-btn
@click="MtdOnSignin"
v-ge="['Authenticate', '']"
color="primary"
class="btn--large"
:disabled="!formUtil.recpatcha || !formUtil.valid1"
v-ge="['Authenticate', '']"
@click="MtdOnSignin"
>
Authenticate&nbsp;
</v-btn>
</v-form>
<template v-else>
<br/>
<br>
<v-alert type="warning" outlined icon="mdi-alert">
<!-- <v-icon color="warning">mdi-alert</v-icon>-->
Authentication not configured in configuration
@@ -202,51 +201,53 @@
</v-col>
</v-row>
<br/>
<br>
</v-col>
</v-row>
</v-container>
</template>
<script>
import Vue from 'vue';
// const {shell} = require("electron").remote.require(
// "./libs"
// );
import {mapGetters, mapActions} from 'vuex';
import {VueReCaptcha} from 'vue-recaptcha-v3';
import {isEmail} from "@/helpers";
import { isEmail } from '@/helpers'
// import VueRecaptcha from 'vue-recaptcha';
export default {
layout: 'empty',
components: {
// VueRecaptcha
},
directives: {},
layout: 'empty',
validate ({ params }) {
return true
},
props: {},
data() {
data () {
return {
form: {
email: null,
password: null,
password: null
},
formRules: {
email: [
// E-mail is required
(v) => !!v || this.$t('signin.form.rules.email_is_reqd'),
v => !!v || this.$t('signin.form.rules.email_is_reqd'),
// E-mail must be valid
(v) => isEmail(v) ||
this.$t('signin.form.rules.email_must_be_valid'),
v => isEmail(v) ||
this.$t('signin.form.rules.email_must_be_valid')
],
password: [
// Password is required
(v) => !!v || this.$t('signin.form.rules.passwd_required'),
v => !!v || this.$t('signin.form.rules.passwd_required'),
// You password must be atleast 8 characters
(v) =>
(v && v.length >= 8) || this.$t('signin.form.rules.passwd_must_be_8_chars'),
],
v =>
(v && v.length >= 8) || this.$t('signin.form.rules.passwd_must_be_8_chars')
]
},
formUtil: {
formErr: false,
@@ -255,144 +256,139 @@ export default {
recpatcha: true,
e3: true,
passwordProgress: 0,
progressColorValue: 'red',
progressColorValue: 'red'
},
valid: false,
e3: true,
recpatcha: false,
};
},
methods: {
openGoogleSiginInBrowser(e) {
e.preventDefault();
shell.openExternal(process.env.auth.google.url);
},
openGithubSiginInBrowser(e) {
e.preventDefault();
shell.openExternal(process.env.auth.github.url);
},
onNormalVerify() {
this.recpatcha = true;
},
PlusCounter() {
this.$store.dispatch('ActPlusCounter');
},
async MtdOnSignin(e) {
e.preventDefault();
if (this.type === 'jwt') {
if (this.$refs.formType.validate()) {
let err = null;
//this.$nuxt.$loading.start()
this.form.firstName = this.form.email;
this.form.lastName = this.form.email;
console.log(process.env.xgene);
// await this.$recaptchaLoaded()
// const recaptchaToken = await this.$recaptcha('login')
err = await this.$store.dispatch('users/ActSignIn', {...this.form}); //, recaptchaToken});
if (err) {
this.formUtil.formErr = true;
this.formUtil.formErrMsg = err.data.msg;
return;
}
//this.$nuxt.$loading.finish()
}
} else if (this.type === 'masterKey') {
const valid = await this.$store.dispatch(
'users/ActVerifyMasterKey',
this.form.secret
);
if (!valid) {
this.formUtil.formErr = true;
this.formUtil.formErrMsg = 'Invalid admin secret';
return;
}
this.$store.commit('users/MutMasterKey', this.form.secret);
}
if ('redirect_to' in this.$route.query) {
this.$router.push(this.$route.query.redirect_to);
} else {
this.$router.push('/projects');
}
},
MtdOnSigninGoogle(e) {
//e.preventDefault();
this.$store.dispatch('users/ActAuthGoogle');
},
MtdOnReset() {
//console.log('in method reset');
},
},
computed: {
counter() {
return this.$store.getters['users/GtrCounter'];
},
displayName() {
return this.$store.getters['users/GtrUser'];
},
type() {
return (
this.$store.state.project.projectInfo &&
this.$store.state.project.projectInfo.authType
);
},
googleAuthEnabled() {
return (
this.$store.state.project.projectInfo &&
this.$store.state.project.projectInfo.googleAuthEnabled
);
},
githubAuthEnabled() {
return (
this.$store.state.project.projectInfo &&
this.$store.state.project.projectInfo.githubAuthEnabled
);
},
},
beforeCreated() {
},
async created() {
// this.type = (await this.$store.dispatch('users/ActGetAuthType')).type;
if (this.$route.query && this.$route.query.error) {
this.$nextTick(() =>
this.$toast.error(this.$route.query.error).goAway(5000)
);
this.$router.replace({path: '/user/authentication/signin'});
recpatcha: false
}
},
mounted() {
},
beforeDestroy() {
},
destroy() {
},
validate({params}) {
return true;
},
head() {
head () {
return {
title: this.$t('signin.head.title'),
meta: [
{
hid: this.$t('signin.head.meta.hid'),
name: this.$t('signin.head.meta.name'),
content: this.$t('signin.head.meta.content'),
},
],
};
content: this.$t('signin.head.meta.content')
}
]
}
},
computed: {
counter () {
return this.$store.getters['users/GtrCounter']
},
displayName () {
return this.$store.getters['users/GtrUser']
},
type () {
return (
this.$store.state.project.projectInfo &&
this.$store.state.project.projectInfo.authType
)
},
googleAuthEnabled () {
return (
this.$store.state.project.projectInfo &&
this.$store.state.project.projectInfo.googleAuthEnabled
)
},
githubAuthEnabled () {
return (
this.$store.state.project.projectInfo &&
this.$store.state.project.projectInfo.githubAuthEnabled
)
}
},
props: {},
watch: {},
directives: {},
};
async created () {
// this.type = (await this.$store.dispatch('users/ActGetAuthType')).type;
if (this.$route.query && this.$route.query.error) {
this.$nextTick(() =>
this.$toast.error(this.$route.query.error).goAway(5000)
)
this.$router.replace({ path: '/user/authentication/signin' })
}
},
mounted () {
},
beforeDestroy () {
},
methods: {
openGoogleSiginInBrowser (e) {
e.preventDefault()
// shell.openExternal(process.env.auth.google.url)
},
openGithubSiginInBrowser (e) {
e.preventDefault()
// shell.openExternal(process.env.auth.github.url)
},
onNormalVerify () {
this.recpatcha = true
},
PlusCounter () {
this.$store.dispatch('ActPlusCounter')
},
async MtdOnSignin (e) {
e.preventDefault()
if (this.type === 'jwt') {
if (this.$refs.formType.validate()) {
let err = null
// this.$nuxt.$loading.start()
this.form.firstName = this.form.email
this.form.lastName = this.form.email
console.log(process.env.xgene)
// await this.$recaptchaLoaded()
// const recaptchaToken = await this.$recaptcha('login')
err = await this.$store.dispatch('users/ActSignIn', { ...this.form }) //, recaptchaToken});
if (err) {
this.formUtil.formErr = true
this.formUtil.formErrMsg = err.data.msg
return
}
// this.$nuxt.$loading.finish()
}
} else if (this.type === 'masterKey') {
const valid = await this.$store.dispatch(
'users/ActVerifyMasterKey',
this.form.secret
)
if (!valid) {
this.formUtil.formErr = true
this.formUtil.formErrMsg = 'Invalid admin secret'
return
}
this.$store.commit('users/MutMasterKey', this.form.secret)
}
if ('redirect_to' in this.$route.query) {
this.$router.push(this.$route.query.redirect_to)
} else {
this.$router.push('/projects')
}
},
MtdOnSigninGoogle (e) {
// e.preventDefault();
this.$store.dispatch('users/ActAuthGoogle')
},
MtdOnReset () {
// console.log('in method reset');
}
},
beforeCreated () {
},
destroy () {
}
}
</script>
<style scoped></style>

View File

@@ -1,12 +1,9 @@
<template>
<v-container class="text-center" fluid>
<v-row class="fluid" align="center">
<v-col class="align-center">
<v-row align="center">
<v-col md="4" offset-md="4">
<v-card class="pa-10 elevation-10 mt-10" color="">
<div
style="position: absolute;top:-45px;
@@ -22,48 +19,45 @@
width="90"
height="90"
:src="require('~/assets/img/icons/512x512-trans.png')"
>
</v-img>
/>
</div>
<h1 class="mt-4">{{ $t('signup.title') }}
<h1 class="mt-4">
{{ $t('signup.title') }}
{{ $route.query.redirect_to === '/referral' ? '& REFER' : '' }}
{{ $route.query.redirect_to === '/pricing' ? '& BUY' : '' }}
</h1>
<div>
<v-alert type="error" dismissible v-model="formUtil.formErr">
<v-alert v-model="formUtil.formErr" type="error" dismissible>
{{ formUtil.formErrMsg }}
</v-alert>
</div>
<v-form v-if=" type === 'jwt'" v-model="formUtil.valid" ref="formType" @submit="MtdOnSignup" elevation-20>
<v-form v-if=" type === 'jwt'" ref="formType" v-model="formUtil.valid" elevation-20 @submit="MtdOnSignup">
<p v-if="firstUser" class="success--text">
{{ $t('signup.message_1') }}
</p>
<v-text-field
label="$t('signin.input_1')"
v-model="form.email"
label="$t('signin.input_1')"
:rules="formRules.email"
required>
</v-text-field>
required
/>
<v-text-field
v-model="form.password"
name="input-10-2"
label="$t('signin.input_2')"
min="8"
:append-icon="formUtil.e3 ? 'visibility' : 'visibility_off'"
@click:append="() => (formUtil.e3 = !formUtil.e3)"
v-model="form.password"
:rules="formRules.password"
:type="formUtil.e3 ? 'password' : 'text'" required>
<template v-slot:progress></template>
:type="formUtil.e3 ? 'password' : 'text'"
required
@click:append="() => (formUtil.e3 = !formUtil.e3)"
>
<template #progress />
</v-text-field>
<!---->
<!-- <vue-recaptcha @verify="onNormalVerify" sitekey="6LfbcqMUAAAAAAb_2319UdF8m68JHSYVy_m4wPBx"-->
@@ -71,8 +65,13 @@
<!-- </vue-recaptcha>-->
<v-btn @click="MtdOnSignup" color="primary" class="btn--large"
:disabled="!formUtil.recpatcha || !formUtil.valid" v-ge="['Sign Up ','']">
<v-btn
v-ge="['Sign Up ','']"
color="primary"
class="btn--large"
:disabled="!formUtil.recpatcha || !formUtil.valid"
@click="MtdOnSignup"
>
&nbsp; {{ $t('signup.title') }} &nbsp;
<v-progress-circular
class="pb-3 pt-0 mt-0"
@@ -80,55 +79,61 @@
width="2"
size="18"
small
color="success">
</v-progress-circular>
color="success"
/>
</v-btn>
<br>
<br>
<br>
<p class="font-weight-light caption" v-ge="['Already have an account ?','']">{{ $t('signup.message_2') }}
<router-link to="/user/authentication/signin">{{ $t('signin.title') }}</router-link>
<p v-ge="['Already have an account ?','']" class="font-weight-light caption">
{{ $t('signup.message_2') }}
<router-link to="/user/authentication/signin">
{{ $t('signin.title') }}
</router-link>
</p>
<v-btn
v-if="googleAuthEnabled"
:href="`${$axios.defaults.baseURL}/auth/google?state=${token}`" outlined
large elevation-10
:href="`${$axios.defaults.baseURL}/auth/google?state=${token}`"
outlined
large
elevation-10
block
color="blue">
<img :src="require('~/assets/img/gmail.png')"
class="img-responsive" alt="google"
width="24px">
color="blue"
>
<img
:src="require('~/assets/img/gmail.png')"
class="img-responsive"
alt="google"
width="24px"
>
<b>&nbsp; &nbsp;Sign In with Google</b>
</v-btn>
</v-form>
<!-- <p class="title">-->
<!-- OR-->
<!-- </p>-->
<v-form v-else-if=" type === 'masterKey'" v-model="formUtil.valid1" ref="formType1" @submit="MtdOnSignup"
elevation-20>
<v-form
v-else-if=" type === 'masterKey'"
ref="formType1"
v-model="formUtil.valid1"
elevation-20
@submit="MtdOnSignup"
>
<v-text-field
label="Admin Secret"
v-model="form.secret"
label="Admin Secret"
:rules="formRules.secret"
min="8"
:append-icon="formUtil.e4 ? 'visibility' : 'visibility_off'"
@click:append="() => (formUtil.e4 = !formUtil.e4)"
:type="formUtil.e4 ? 'password' : 'text'"
required>
</v-text-field>
required
@click:append="() => (formUtil.e4 = !formUtil.e4)"
/>
<!---->
@@ -137,21 +142,21 @@
<!-- </vue-recaptcha>-->
<v-btn @click="MtdOnSignup" color="primary" class="btn--large"
:disabled="!formUtil.recpatcha || !formUtil.valid1" v-ge="['Authenticate','']">
<v-btn
v-ge="['Authenticate','']"
color="primary"
class="btn--large"
:disabled="!formUtil.recpatcha || !formUtil.valid1"
@click="MtdOnSignup"
>
Authenticate&nbsp;
</v-btn>
<br>
<!-- <div>-->
<br>
<!-- <div>-->
<!-- <v-btn
<!-- <v-btn
v-if="googleAuthEnabled"
:href="`${$axios.defaults.baseURL}/auth/google?state=${token}`" outlined
@@ -174,11 +179,10 @@
<b>&nbsp; &nbsp;Sign In with Github</b>
</v-btn>-->
<!-- </div>-->
<!-- </div>-->
</v-form>
<template v-else-if="type==='none'">
<br/>
<br>
<v-alert type="warning" outlined icon="mdi-alert">
<!-- <v-icon color="warning">mdi-alert</v-icon>-->
Authentication not configured in configuration
@@ -189,18 +193,17 @@
<br>
<v-row justify="center">
<p class="text-right grey--text font-weight-light caption">By signing up, you agree to
<span @click="openUrl('https://nocodb.com/terms-of-service')" class="grey--text pointer"><u>Terms of service</u></span>
<p class="text-right grey--text font-weight-light caption">
By signing up, you agree to
<span class="grey--text pointer" @click="openUrl('https://nocodb.com/terms-of-service')"><u>Terms of service</u></span>
</p> &nbsp;
<div class="d-flex align-center mb-4 justify-center">
<v-checkbox v-model="subscribe" color="grey" dense hide-details class="mt-0 pt-0"></v-checkbox>
<v-checkbox v-model="subscribe" color="grey" dense hide-details class="mt-0 pt-0" />
<label class="caption grey--text font-weight-light">Subscribe to our weekly newsletter</label>
</div>
</v-row>
<!--<br>-->
<!--<h3>OR</h3>-->
<!--<br>-->
@@ -214,14 +217,11 @@
<!--</v-card>-->
<!--<br>-->
<!--<br>-->
</v-col>
</v-row>
</v-col>
</v-row>
</v-container>
</template>
<script>
@@ -229,18 +229,21 @@
// const {shell} = require("electron").remote.require(
// "./libs"
// );
import {mapGetters, mapActions} from 'vuex'
import {isEmail} from "@/helpers";
import { isEmail } from '@/helpers'
// import VueRecaptcha from 'vue-recaptcha';
export default {
layout: 'empty',
components: {
// VueRecaptcha
},
directives: {},
layout: 'empty',
validate () {
return true
},
props: {},
data() {
data () {
return {
subscribe: true,
isDev: (process.env.NODE_ENV === 'dev'),
@@ -248,7 +251,7 @@ export default {
dialog: false,
form: {
email: null,
password: null,
password: null
},
formRules: {
@@ -275,179 +278,40 @@ export default {
progressColorValue: 'red'
},
googleAuthUrl: "/api/auth/google",
facebookAuthUrl: "/api/auth/facebook",
googleAuthUrl: '/api/auth/google',
facebookAuthUrl: '/api/auth/facebook'
}
},
methods: {
openUrl(url) {
shell.openExternal(url);
},
openGoogleSiginInBrowser(e) {
e.preventDefault();
// if(this._isMac) {
shell.openExternal(process.env.auth.google.url);
// }else{
//
// }
},
openGithubSiginInBrowser(e) {
e.preventDefault();
shell.openExternal(process.env.auth.github.url);
},
onNormalVerify() {
this.formUtil.recpatcha = true;
//this.formUtil.recpatcha = false;
},
progressColor(num) {
return this.formUtil.progressColorValue = ['error', 'warning', 'info', 'success'][Math.floor(num / 25)]
},
PasswordValidate(p) {
if (!p) {
this.passwordProgress = 0;
this.passwordValidateMsg = 'Atleast 8 letters with one Uppercase, one number and one special letter'
return false;
}
let msg = '';
let validation = true;
let progress = 0;
if (!(p.length >= 8)) {
msg += 'Atleast 8 letters. '
validation = validation && false;
} else {
progress = Math.min(100, progress + 25)
}
if (!(p.match(/.*[A-Z].*/))) {
msg += 'One Uppercase Letter. '
validation = validation && false;
} else {
progress = Math.min(100, progress + 25)
}
if (!(p.match(/.*[0-9].*/))) {
msg += 'One Number. '
validation = validation && false;
} else {
progress = Math.min(100, progress + 25)
}
if (!(p.match(/[$&+,:;=?@#|'<>.^*()%!-]/))) {
msg += 'One special letter. '
validation = validation && false;
} else {
progress = Math.min(100, progress + 25)
}
this.formUtil.passwordProgress = progress;
// console.log('progress', progress);
// console.log('color', this.progressColor(this.formUtil.passwordProgress));
this.progressColorValue = this.progressColor(this.formUtil.passwordProgress);
this.formUtil.passwordValidateMsg = msg;
//console.log('msg', msg, validation);
return validation;
},
PlusCounter() {
this.$store.dispatch('ActPlusCounter')
},
async MtdOnSignup(e) {
e.preventDefault();
if (this.type === 'jwt') {
if (this.$refs.formType.validate()) {
//this.$nuxt.$loading.start()
//console.log('hello', this.form);
this.form.firstName = this.form.username;
this.form.lastName = this.form.username;
//
// await this.$recaptchaLoaded()
// const recaptchaToken = await this.$recaptcha('login')
let err = await this.$store.dispatch('users/ActSignUp', {
...this.form,
token: this.$route.params.token,
ignore_subscribe: !this.subscribe
})// recaptchaToken});
//console.log('in method signup', err);
await this.$store.dispatch('project/ActLoadProjectInfo');
if (err) {
this.formUtil.formErr = true;
this.formUtil.formErrMsg = err.data.msg;
console.log(err.data.msg);
return
}
//this.$nuxt.$loading.finish()
}
} else if (this.type === 'masterKey') {
const valid = await this.$store.dispatch('users/ActVerifyMasterKey', this.form.secret);
if (!valid) {
this.formUtil.formErr = true;
this.formUtil.formErrMsg = 'Invalid admin secret';
return
}
this.$store.commit('users/MutMasterKey', this.form.secret);
}
if ('redirect_to' in this.$route.query) {
this.$router.push(this.$route.query.redirect_to);
} else {
this.$router.push('/projects?toast');
}
},
MtdOnReset() {
//console.log('in method reset');
},
async MtdOnSignupGoogle(e) {
let err = null;
err = await this.$store.dispatch('users/ActAuthGoogle');
//console.log('MtdOnSignupGoogle', err);
},
head () {
return {
title: 'Sign Up | Noco',
meta: [
{ hid: 'Sign Up To Noco', name: 'Sign Up To Noco', content: 'Sign Up To Noco' }
]
}
},
computed: {
counter() {
counter () {
return this.$store.getters['users/GtrCounter']
},
displayName() {
displayName () {
return this.$store.getters['users/GtrUser']
},
type() {
return this.$store.state.project.projectInfo && this.$store.state.project.projectInfo.authType;
type () {
return this.$store.state.project.projectInfo && this.$store.state.project.projectInfo.authType
},
firstUser() {
return this.$store.state.project.projectInfo && this.$store.state.project.projectInfo.firstUser;
firstUser () {
return this.$store.state.project.projectInfo && this.$store.state.project.projectInfo.firstUser
},
googleAuthEnabled() {
return this.$store.state.project.projectInfo && this.$store.state.project.projectInfo.googleAuthEnabled;
googleAuthEnabled () {
return this.$store.state.project.projectInfo && this.$store.state.project.projectInfo.googleAuthEnabled
},
token() {
return this.$route.params.token;
token () {
return this.$route.params.token
}
},
beforeCreated() {
},
async created() {
watch: {},
async created () {
// const type = await this.$store.dispatch('users/ActGetAuthType');
// this.type = type.type;
@@ -456,38 +320,157 @@ export default {
// ckeditor.setAttribute('src',"https://www.google.com/recaptcha/api.js");
// document.head.appendChild(ckeditor);
},
mounted() {
//console.log(this.$route.query);
mounted () {
// console.log(this.$route.query);
if ('buy' in this.$route.query) {
this.googleAuthUrl += '?redirect_to=/';
this.facebookAuthUrl += '?redirect_to=/';
this.googleAuthUrl += '?redirect_to=/'
this.facebookAuthUrl += '?redirect_to=/'
} else {
this.googleAuthUrl += '?redirect_to=/';
this.facebookAuthUrl += '?redirect_to=/';
this.googleAuthUrl += '?redirect_to=/'
this.facebookAuthUrl += '?redirect_to=/'
}
},
beforeDestroy () {
},
methods: {
openUrl (url) {
window.open(url, '_blank')
},
openGoogleSiginInBrowser (e) {
e.preventDefault()
},
openGithubSiginInBrowser (e) {
e.preventDefault()
// shell.openExternal(process.env.auth.github.url)
},
onNormalVerify () {
this.formUtil.recpatcha = true
// this.formUtil.recpatcha = false;
},
progressColor (num) {
this.formUtil.progressColorValue = ['error', 'warning', 'info', 'success'][Math.floor(num / 25)]
return this.formUtil.progressColorValue
},
PasswordValidate (p) {
if (!p) {
this.passwordProgress = 0
this.passwordValidateMsg = 'Atleast 8 letters with one Uppercase, one number and one special letter'
return false
}
let msg = ''
let validation = true
let progress = 0
if (!(p.length >= 8)) {
msg += 'Atleast 8 letters. '
validation = validation && false
} else {
progress = Math.min(100, progress + 25)
}
if (!(p.match(/.*[A-Z].*/))) {
msg += 'One Uppercase Letter. '
validation = validation && false
} else {
progress = Math.min(100, progress + 25)
}
if (!(p.match(/.*[0-9].*/))) {
msg += 'One Number. '
validation = validation && false
} else {
progress = Math.min(100, progress + 25)
}
if (!(p.match(/[$&+,:;=?@#|'<>.^*()%!-]/))) {
msg += 'One special letter. '
validation = validation && false
} else {
progress = Math.min(100, progress + 25)
}
this.formUtil.passwordProgress = progress
// console.log('progress', progress);
// console.log('color', this.progressColor(this.formUtil.passwordProgress));
this.progressColorValue = this.progressColor(this.formUtil.passwordProgress)
this.formUtil.passwordValidateMsg = msg
// console.log('msg', msg, validation);
return validation
},
PlusCounter () {
this.$store.dispatch('ActPlusCounter')
},
async MtdOnSignup (e) {
e.preventDefault()
if (this.type === 'jwt') {
if (this.$refs.formType.validate()) {
// this.$nuxt.$loading.start()
// console.log('hello', this.form);
this.form.firstName = this.form.username
this.form.lastName = this.form.username
//
// await this.$recaptchaLoaded()
// const recaptchaToken = await this.$recaptcha('login')
const err = await this.$store.dispatch('users/ActSignUp', {
...this.form,
token: this.$route.params.token,
ignore_subscribe: !this.subscribe
})// recaptchaToken});
// console.log('in method signup', err);
await this.$store.dispatch('project/ActLoadProjectInfo')
if (err) {
this.formUtil.formErr = true
this.formUtil.formErrMsg = err.data.msg
console.log(err.data.msg)
return
}
// this.$nuxt.$loading.finish()
}
} else if (this.type === 'masterKey') {
const valid = await this.$store.dispatch('users/ActVerifyMasterKey', this.form.secret)
if (!valid) {
this.formUtil.formErr = true
this.formUtil.formErrMsg = 'Invalid admin secret'
return
}
this.$store.commit('users/MutMasterKey', this.form.secret)
}
if ('redirect_to' in this.$route.query) {
this.$router.push(this.$route.query.redirect_to)
} else {
this.$router.push('/projects?toast')
}
},
MtdOnReset () {
// console.log('in method reset');
},
async MtdOnSignupGoogle (e) {
await this.$store.dispatch('users/ActAuthGoogle')
// console.log('MtdOnSignupGoogle', err);
}
},
beforeDestroy() {
},
destroy() {
},
validate({params}) {
return true
},
head() {
return {
title: 'Sign Up | Noco',
meta: [
{hid: 'Sign Up To Noco', name: 'Sign Up To Noco', content: 'Sign Up To Noco'}
]
}
beforeCreated () {
},
props: {},
watch: {},
directives: {},
destroy () {
}
}
</script>

View File

@@ -1,12 +1,9 @@
<template>
<v-container class="text-center" fluid>
<v-row class="fluid" align="center">
<v-col class="align-center">
<v-row align="center">
<v-col md="4" offset-md="4">
<v-card class="pa-10 elevation-10 mt-10" color="">
<div
style="position: absolute;top:-45px;
@@ -22,48 +19,45 @@
width="90"
height="90"
:src="require('~/assets/img/icons/512x512-trans.png')"
>
</v-img>
/>
</div>
<h1 class="mt-4">SIGN UP
<h1 class="mt-4">
SIGN UP
{{ $route.query.redirect_to === '/referral' ? '& REFER' : '' }}
{{ $route.query.redirect_to === '/pricing' ? '& BUY' : '' }}
</h1>
<div>
<v-alert type="error" dismissible v-model="formUtil.formErr">
<v-alert v-model="formUtil.formErr" type="error" dismissible>
{{ formUtil.formErrMsg }}
</v-alert>
</div>
<v-form v-if=" type === 'jwt'" v-model="formUtil.valid" ref="formType" @submit="MtdOnSignup" elevation-20>
<v-form v-if=" type === 'jwt'" ref="formType" v-model="formUtil.valid" elevation-20 @submit="MtdOnSignup">
<p v-if="firstUser" class="success--text">
You will be the 'Super Admin'
</p>
<v-text-field
label="$t('signin.input_1')"
v-model="form.email"
label="$t('signin.input_1')"
:rules="formRules.email"
required>
</v-text-field>
required
/>
<v-text-field
v-model="form.password"
name="input-10-2"
label="$t('signin.input_2')"
min="8"
:append-icon="formUtil.e3 ? 'visibility' : 'visibility_off'"
@click:append="() => (formUtil.e3 = !formUtil.e3)"
v-model="form.password"
:rules="formRules.password"
:type="formUtil.e3 ? 'password' : 'text'" required>
<template v-slot:progress></template>
:type="formUtil.e3 ? 'password' : 'text'"
required
@click:append="() => (formUtil.e3 = !formUtil.e3)"
>
<template #progress />
</v-text-field>
<!---->
<!-- <vue-recaptcha @verify="onNormalVerify" sitekey="6LfbcqMUAAAAAAb_2319UdF8m68JHSYVy_m4wPBx"-->
@@ -71,40 +65,49 @@
<!-- </vue-recaptcha>-->
<v-btn @click="MtdOnSignup" color="primary" class="btn--large" :loading="signUpButtonLoading"
:disabled="!formUtil.recpatcha || !formUtil.valid" v-ge="['Sign Up ','']">
<v-btn
v-ge="['Sign Up ','']"
color="primary"
class="btn--large"
:loading="signUpButtonLoading"
:disabled="!formUtil.recpatcha || !formUtil.valid"
@click="MtdOnSignup"
>
&nbsp; {{ $t('signup.title') }} &nbsp;
</v-btn>
<br>
<br>
<br>
<p class="font-weight-light caption grey--text" v-ge="['Already have an account ?','']">{{ $t('signup.message_2') }}
<router-link to="/user/authentication/signin">{{ $t('signin.title') }}</router-link>
<p v-ge="['Already have an account ?','']" class="font-weight-light caption grey--text">
{{ $t('signup.message_2') }}
<router-link to="/user/authentication/signin">
{{ $t('signin.title') }}
</router-link>
</p>
</v-form>
<!-- <p class="title">-->
<!-- OR-->
<!-- </p>-->
<v-form v-else-if=" type === 'masterKey'" v-model="formUtil.valid1" ref="formType1" @submit="MtdOnSignup"
elevation-20>
<v-form
v-else-if=" type === 'masterKey'"
ref="formType1"
v-model="formUtil.valid1"
elevation-20
@submit="MtdOnSignup"
>
<v-text-field
label="Admin Secret"
v-model="form.secret"
label="Admin Secret"
:rules="formRules.secret"
min="8"
:append-icon="formUtil.e4 ? 'visibility' : 'visibility_off'"
@click:append="() => (formUtil.e4 = !formUtil.e4)"
:type="formUtil.e4 ? 'password' : 'text'"
required>
</v-text-field>
required
@click:append="() => (formUtil.e4 = !formUtil.e4)"
/>
<!---->
@@ -113,47 +116,52 @@
<!-- </vue-recaptcha>-->
<v-btn @click="MtdOnSignup" color="primary" class="btn--large"
:disabled="!formUtil.recpatcha || !formUtil.valid1" v-ge="['Authenticate','']">
<v-btn
v-ge="['Authenticate','']"
color="primary"
class="btn--large"
:disabled="!formUtil.recpatcha || !formUtil.valid1"
@click="MtdOnSignup"
>
Authenticate&nbsp;
</v-btn>
</v-form>
<br>
<div>
<v-btn
v-if="googleAuthEnabled"
:href="`${this.$axios.defaults.baseURL}/auth/google`" outlined large elevation-10
:href="`${$axios.defaults.baseURL}/auth/google`"
outlined
large
elevation-10
block
color="blue">
<img :src="require('~/assets/img/gmail.png')"
class="img-responsive" alt="google"
width="24px">
color="blue"
>
<img
:src="require('~/assets/img/gmail.png')"
class="img-responsive"
alt="google"
width="24px"
>
<b>&nbsp; &nbsp;Sign In with Google</b>
</v-btn>
<!-- <v-btn-->
<!-- class="mt-5"-->
<!-- @click="openGithubSiginInBrowser"-->
<!-- outlined large elevation-10 block color="blue"-->
<!-- v-ge="['Sign In with Github','']">-->
<!-- <img src="~/assets/img/github.png"-->
<!-- class="img-responsive" alt="google"-->
<!-- width="24px">-->
<!-- <b>&nbsp; &nbsp;Sign In with Github</b>-->
<!-- </v-btn>-->
<!-- <v-btn-->
<!-- class="mt-5"-->
<!-- @click="openGithubSiginInBrowser"-->
<!-- outlined large elevation-10 block color="blue"-->
<!-- v-ge="['Sign In with Github','']">-->
<!-- <img src="~/assets/img/github.png"-->
<!-- class="img-responsive" alt="google"-->
<!-- width="24px">-->
<!-- <b>&nbsp; &nbsp;Sign In with Github</b>-->
<!-- </v-btn>-->
</div>
<template v-if="type==='none'">
<br/>
<br>
<v-alert type="warning" outlined icon="mdi-alert">
<!-- <v-icon color="warning">mdi-alert</v-icon>-->
Authentication not configured in configuration
@@ -164,18 +172,17 @@
<br>
<v-row justify="center">
<p class="text-right grey--text font-weight-light caption">By signing up, you agree to
<span @click="openUrl('https://nocodb.com/terms-of-service')" class="grey--text pointer"><u>Terms of service</u></span>
<p class="text-right grey--text font-weight-light caption">
By signing up, you agree to
<span class="grey--text pointer" @click="openUrl('https://nocodb.com/terms-of-service')"><u>Terms of service</u></span>
</p> &nbsp;
<div class="d-flex align-center mb-4 justify-center">
<v-checkbox v-model="subscribe" color="grey" dense hide-details class="mt-0 pt-0"></v-checkbox>
<v-checkbox v-model="subscribe" color="grey" dense hide-details class="mt-0 pt-0" />
<label class="caption grey--text font-weight-light">Subscribe to our weekly newsletter</label>
</div>
</v-row>
<!--<br>-->
<!--<h3>OR</h3>-->
<!--<br>-->
@@ -189,33 +196,30 @@
<!--</v-card>-->
<!--<br>-->
<!--<br>-->
</v-col>
</v-row>
</v-col>
</v-row>
</v-container>
</template>
<script>
// const {shell} = require("electron").remote.require(
// "./libs"
// );
import {mapGetters, mapActions} from 'vuex'
import {isEmail} from "@/helpers";
import { isEmail } from '@/helpers'
// import VueRecaptcha from 'vue-recaptcha';
export default {
layout: 'empty',
components: {
// VueRecaptcha
},
directives: {},
layout: 'empty',
validate ({ params }) {
return true
},
props: {},
data() {
data () {
return {
subscribe: true,
isDev: (process.env.NODE_ENV === 'dev'),
@@ -223,7 +227,7 @@ export default {
dialog: false,
form: {
email: null,
password: null,
password: null
},
formRules: {
@@ -251,181 +255,39 @@ export default {
progressColorValue: 'red'
},
googleAuthUrl: "/api/auth/google",
facebookAuthUrl: "/api/auth/facebook",
googleAuthUrl: '/api/auth/google',
facebookAuthUrl: '/api/auth/facebook',
signUpButtonLoading: false
}
},
methods: {
openUrl(url) {
shell.openExternal(url);
},
openGoogleSiginInBrowser(e) {
e.preventDefault();
// if(this._isMac) {
shell.openExternal(process.env.auth.google.url);
// }else{
//
// }
},
openGithubSiginInBrowser(e) {
e.preventDefault();
shell.openExternal(process.env.auth.github.url);
},
onNormalVerify() {
this.formUtil.recpatcha = true;
//this.formUtil.recpatcha = false;
},
progressColor(num) {
return this.formUtil.progressColorValue = ['error', 'warning', 'info', 'success'][Math.floor(num / 25)]
},
PasswordValidate(p) {
if (!p) {
this.passwordProgress = 0;
this.passwordValidateMsg = 'Atleast 8 letters with one Uppercase, one number and one special letter'
return false;
}
let msg = '';
let validation = true;
let progress = 0;
if (!(p.length >= 8)) {
msg += 'Atleast 8 letters. '
validation = validation && false;
} else {
progress = Math.min(100, progress + 25)
}
if (!(p.match(/.*[A-Z].*/))) {
msg += 'One Uppercase Letter. '
validation = validation && false;
} else {
progress = Math.min(100, progress + 25)
}
if (!(p.match(/.*[0-9].*/))) {
msg += 'One Number. '
validation = validation && false;
} else {
progress = Math.min(100, progress + 25)
}
if (!(p.match(/[$&+,:;=?@#|'<>.^*()%!-]/))) {
msg += 'One special letter. '
validation = validation && false;
} else {
progress = Math.min(100, progress + 25)
}
this.formUtil.passwordProgress = progress;
// console.log('progress', progress);
// console.log('color', this.progressColor(this.formUtil.passwordProgress));
this.progressColorValue = this.progressColor(this.formUtil.passwordProgress);
this.formUtil.passwordValidateMsg = msg;
//console.log('msg', msg, validation);
return validation;
},
PlusCounter() {
this.$store.dispatch('ActPlusCounter')
},
async MtdOnSignup(e) {
e.preventDefault();
this.signUpButtonLoading = true;
if (this.type === 'jwt') {
if (this.$refs.formType.validate()) {
//this.$nuxt.$loading.start()
//console.log('hello', this.form);
this.form.firstName = this.form.username;
this.form.lastName = this.form.username;
//
// await this.$recaptchaLoaded()
// const recaptchaToken = await this.$recaptcha('login')
let err = await this.$store.dispatch('users/ActSignUp', {...this.form, ignore_subscribe: !this.subscribe})// recaptchaToken});
//console.log('in method signup', err);
await this.$store.dispatch('project/ActLoadProjectInfo');
if (err) {
this.formUtil.formErr = true;
this.formUtil.formErrMsg = err.data.msg;
console.log(err.data.msg);
this.signUpButtonLoading = false;
return
}
//this.$nuxt.$loading.finish()
}
} else if (this.type === 'masterKey') {
const valid = await this.$store.dispatch('users/ActVerifyMasterKey', this.form.secret);
if (!valid) {
this.formUtil.formErr = true;
this.formUtil.formErrMsg = 'Invalid admin secret';
this.signUpButtonLoading = false;
return
}
this.$store.commit('users/MutMasterKey', this.form.secret);
}
if ('redirect_to' in this.$route.query) {
this.$router.push(this.$route.query.redirect_to);
} else {
this.$router.push('/projects?toast');
}
this.signUpButtonLoading = false;
},
MtdOnReset() {
//console.log('in method reset');
},
async MtdOnSignupGoogle(e) {
let err = null;
err = await this.$store.dispatch('users/ActAuthGoogle');
//console.log('MtdOnSignupGoogle', err);
},
},
computed: {
counter() {
return this.$store.getters['users/GtrCounter']
},
displayName() {
return this.$store.getters['users/GtrUser']
},
type() {
return this.$store.state.project.projectInfo && this.$store.state.project.projectInfo.authType;
},
firstUser() {
return this.$store.state.project.projectInfo && this.$store.state.project.projectInfo.firstUser;
},
googleAuthEnabled() {
return this.$store.state.project.projectInfo && this.$store.state.project.projectInfo.googleAuthEnabled;
head () {
return {
title: 'Sign Up | Noco',
meta: [
{ hid: 'Sign Up To Noco', name: 'Sign Up To Noco', content: 'Sign Up To Noco' }
]
}
},
beforeCreated() {
computed: {
counter () {
return this.$store.getters['users/GtrCounter']
},
displayName () {
return this.$store.getters['users/GtrUser']
},
type () {
return this.$store.state.project.projectInfo && this.$store.state.project.projectInfo.authType
},
firstUser () {
return this.$store.state.project.projectInfo && this.$store.state.project.projectInfo.firstUser
},
googleAuthEnabled () {
return this.$store.state.project.projectInfo && this.$store.state.project.projectInfo.googleAuthEnabled
}
},
async created() {
watch: {},
async created () {
// const type = await this.$store.dispatch('users/ActGetAuthType');
// this.type = type.type;
@@ -434,38 +296,165 @@ export default {
// ckeditor.setAttribute('src',"https://www.google.com/recaptcha/api.js");
// document.head.appendChild(ckeditor);
},
mounted() {
//console.log(this.$route.query);
mounted () {
// console.log(this.$route.query);
if ('buy' in this.$route.query) {
this.googleAuthUrl += '?redirect_to=/';
this.facebookAuthUrl += '?redirect_to=/';
this.googleAuthUrl += '?redirect_to=/'
this.facebookAuthUrl += '?redirect_to=/'
} else {
this.googleAuthUrl += '?redirect_to=/';
this.facebookAuthUrl += '?redirect_to=/';
this.googleAuthUrl += '?redirect_to=/'
this.facebookAuthUrl += '?redirect_to=/'
}
},
beforeDestroy () {
},
methods: {
openUrl (url) {
window.open(url, '_blank')
},
openGoogleSiginInBrowser (e) {
e.preventDefault()
// if(this._isMac) {
// shell.openExternal(process.env.auth.google.url)
// }else{
//
// }
},
openGithubSiginInBrowser (e) {
e.preventDefault()
// shell.openExternal(process.env.auth.github.url)
},
onNormalVerify () {
this.formUtil.recpatcha = true
// this.formUtil.recpatcha = false;
},
progressColor (num) {
this.formUtil.progressColorValue = ['error', 'warning', 'info', 'success'][Math.floor(num / 25)]
return this.formUtil.progressColorValue
},
PasswordValidate (p) {
if (!p) {
this.passwordProgress = 0
this.passwordValidateMsg = 'Atleast 8 letters with one Uppercase, one number and one special letter'
return false
}
let msg = ''
let validation = true
let progress = 0
if (!(p.length >= 8)) {
msg += 'Atleast 8 letters. '
validation = validation && false
} else {
progress = Math.min(100, progress + 25)
}
if (!(p.match(/.*[A-Z].*/))) {
msg += 'One Uppercase Letter. '
validation = validation && false
} else {
progress = Math.min(100, progress + 25)
}
if (!(p.match(/.*[0-9].*/))) {
msg += 'One Number. '
validation = validation && false
} else {
progress = Math.min(100, progress + 25)
}
if (!(p.match(/[$&+,:;=?@#|'<>.^*()%!-]/))) {
msg += 'One special letter. '
validation = validation && false
} else {
progress = Math.min(100, progress + 25)
}
this.formUtil.passwordProgress = progress
// console.log('progress', progress);
// console.log('color', this.progressColor(this.formUtil.passwordProgress));
this.progressColorValue = this.progressColor(this.formUtil.passwordProgress)
this.formUtil.passwordValidateMsg = msg
// console.log('msg', msg, validation);
return validation
},
PlusCounter () {
this.$store.dispatch('ActPlusCounter')
},
async MtdOnSignup (e) {
e.preventDefault()
this.signUpButtonLoading = true
if (this.type === 'jwt') {
if (this.$refs.formType.validate()) {
// this.$nuxt.$loading.start()
// console.log('hello', this.form);
this.form.firstName = this.form.username
this.form.lastName = this.form.username
//
// await this.$recaptchaLoaded()
// const recaptchaToken = await this.$recaptcha('login')
const err = await this.$store.dispatch('users/ActSignUp', { ...this.form, ignore_subscribe: !this.subscribe })// recaptchaToken});
// console.log('in method signup', err);
await this.$store.dispatch('project/ActLoadProjectInfo')
if (err) {
this.formUtil.formErr = true
this.formUtil.formErrMsg = err.data.msg
console.log(err.data.msg)
this.signUpButtonLoading = false
return
}
// this.$nuxt.$loading.finish()
}
} else if (this.type === 'masterKey') {
const valid = await this.$store.dispatch('users/ActVerifyMasterKey', this.form.secret)
if (!valid) {
this.formUtil.formErr = true
this.formUtil.formErrMsg = 'Invalid admin secret'
this.signUpButtonLoading = false
return
}
this.$store.commit('users/MutMasterKey', this.form.secret)
}
if ('redirect_to' in this.$route.query) {
this.$router.push(this.$route.query.redirect_to)
} else {
this.$router.push('/projects?toast')
}
this.signUpButtonLoading = false
},
MtdOnReset () {
// console.log('in method reset');
},
async MtdOnSignupGoogle (e) {
await this.$store.dispatch('users/ActAuthGoogle')
// console.log('MtdOnSignupGoogle', err);
}
},
beforeDestroy() {
},
destroy() {
},
validate({params}) {
return true
},
head() {
return {
title: 'Sign Up | Noco',
meta: [
{hid: 'Sign Up To Noco', name: 'Sign Up To Noco', content: 'Sign Up To Noco'}
]
}
beforeCreated () {
},
props: {},
watch: {},
directives: {},
destroy () {
}
}
</script>