mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
480 lines
16 KiB
480 lines
16 KiB
4 years ago
|
<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
|
||
3 years ago
|
style="
|
||
|
position: absolute;
|
||
|
top: -45px;
|
||
|
left: -moz-calc(50% - 45px);
|
||
|
left: -webkit-calc(50% - 45px);
|
||
|
left: calc(50% - 45px);
|
||
4 years ago
|
border-radius: 15px;
|
||
3 years ago
|
"
|
||
4 years ago
|
class="primary"
|
||
|
>
|
||
3 years ago
|
<v-img class="mx-auto" width="90" height="90" :src="require('~/assets/img/icons/512x512-trans.png')" />
|
||
4 years ago
|
</div>
|
||
|
|
||
3 years ago
|
<h1 class="mt-4">
|
||
3 years ago
|
{{ $t('general.signUp') }}
|
||
4 years ago
|
{{ $route.query.redirect_to === '/referral' ? '& REFER' : '' }}
|
||
|
{{ $route.query.redirect_to === '/pricing' ? '& BUY' : '' }}
|
||
|
</h1>
|
||
|
<div>
|
||
3 years ago
|
<v-alert v-model="formUtil.formErr" type="error" dismissible>
|
||
4 years ago
|
{{ formUtil.formErrMsg }}
|
||
|
</v-alert>
|
||
|
</div>
|
||
3 years ago
|
<v-form v-if="type === 'jwt'" ref="formType" v-model="formUtil.valid" elevation-20 @submit="MtdOnSignup">
|
||
4 years ago
|
<p v-if="firstUser" class="success--text">
|
||
3 years ago
|
<!-- You will be the 'Super Admin' -->
|
||
|
{{ $t('msg.info.signUp.superAdmin') }}
|
||
4 years ago
|
</p>
|
||
|
|
||
|
<v-text-field
|
||
|
v-model="form.email"
|
||
3 years ago
|
:label="$t('msg.info.signUp.workEmail')"
|
||
4 years ago
|
:rules="formRules.email"
|
||
3 years ago
|
required
|
||
|
/>
|
||
4 years ago
|
|
||
|
<v-text-field
|
||
3 years ago
|
v-model="form.password"
|
||
4 years ago
|
name="input-10-2"
|
||
3 years ago
|
:label="$t('msg.info.signUp.enterPassword')"
|
||
4 years ago
|
min="8"
|
||
|
:append-icon="formUtil.e3 ? 'visibility' : 'visibility_off'"
|
||
|
:rules="formRules.password"
|
||
3 years ago
|
:type="formUtil.e3 ? 'password' : 'text'"
|
||
|
required
|
||
|
@click:append="() => (formUtil.e3 = !formUtil.e3)"
|
||
|
>
|
||
|
<template #progress />
|
||
4 years ago
|
</v-text-field>
|
||
|
|
||
3 years ago
|
<v-btn
|
||
3 years ago
|
v-ge="['Sign Up ', '']"
|
||
3 years ago
|
color="primary"
|
||
|
class="btn--large"
|
||
|
:disabled="!formUtil.recpatcha || !formUtil.valid"
|
||
|
@click="MtdOnSignup"
|
||
|
>
|
||
3 years ago
|
{{ $t('general.signUp') }}
|
||
4 years ago
|
<v-progress-circular
|
||
|
class="pb-3 pt-0 mt-0"
|
||
|
:value="formUtil.passwordProgress"
|
||
|
width="2"
|
||
|
size="18"
|
||
|
small
|
||
3 years ago
|
color="success"
|
||
|
/>
|
||
4 years ago
|
</v-btn>
|
||
|
|
||
3 years ago
|
<br />
|
||
|
<br />
|
||
3 years ago
|
<div class="d-flex align-center justify-center mb-2">
|
||
3 years ago
|
<v-switch v-model="subscribe" dense hide-details class="mt-0 pt-0" />
|
||
3 years ago
|
<label class="caption font-weight-light">Subscribe to our weekly newsletter</label>
|
||
|
</div>
|
||
3 years ago
|
<p v-ge="['Already have an account ?', '']" class="font-weight-light caption">
|
||
3 years ago
|
{{ $t('msg.info.signUp.alreadyHaveAccount') }}
|
||
3 years ago
|
<router-link to="/user/authentication/signin">
|
||
3 years ago
|
{{ $t('general.signIn') }}
|
||
3 years ago
|
</router-link>
|
||
4 years ago
|
</p>
|
||
|
|
||
|
<v-btn
|
||
|
v-if="googleAuthEnabled"
|
||
3 years ago
|
:href="`${$axios.defaults.baseURL}/auth/google?state=${token}`"
|
||
|
outlined
|
||
|
large
|
||
|
elevation-10
|
||
4 years ago
|
block
|
||
3 years ago
|
color="blue"
|
||
|
>
|
||
3 years ago
|
<img :src="require('~/assets/img/gmail.png')" class="img-responsive" alt="google" width="24px" />
|
||
4 years ago
|
<b> Sign In with Google</b>
|
||
|
</v-btn>
|
||
|
</v-form>
|
||
|
<!-- <p class="title">-->
|
||
|
<!-- OR-->
|
||
|
<!-- </p>-->
|
||
|
|
||
3 years ago
|
<v-form
|
||
3 years ago
|
v-else-if="type === 'masterKey'"
|
||
3 years ago
|
ref="formType1"
|
||
|
v-model="formUtil.valid1"
|
||
|
elevation-20
|
||
|
@submit="MtdOnSignup"
|
||
|
>
|
||
4 years ago
|
<v-text-field
|
||
|
v-model="form.secret"
|
||
3 years ago
|
label="Admin Secret"
|
||
4 years ago
|
:rules="formRules.secret"
|
||
|
min="8"
|
||
|
:append-icon="formUtil.e4 ? 'visibility' : 'visibility_off'"
|
||
|
:type="formUtil.e4 ? 'password' : 'text'"
|
||
3 years ago
|
required
|
||
|
@click:append="() => (formUtil.e4 = !formUtil.e4)"
|
||
|
/>
|
||
4 years ago
|
|
||
|
<!---->
|
||
|
|
||
|
<!-- <vue-recaptcha @verify="onNormalVerify" sitekey="6LfbcqMUAAAAAAb_2319UdF8m68JHSYVy_m4wPBx"-->
|
||
|
<!-- style="transform:scale(0.7);-webkit-transform:scale(0.7);transform-origin:0 0;-webkit-transform-origin:0 0;">-->
|
||
|
|
||
|
<!-- </vue-recaptcha>-->
|
||
|
|
||
3 years ago
|
<v-btn
|
||
3 years ago
|
v-ge="['Authenticate', '']"
|
||
3 years ago
|
color="primary"
|
||
|
class="btn--large"
|
||
|
:disabled="!formUtil.recpatcha || !formUtil.valid1"
|
||
|
@click="MtdOnSignup"
|
||
|
>
|
||
4 years ago
|
Authenticate
|
||
|
</v-btn>
|
||
|
|
||
3 years ago
|
<br />
|
||
4 years ago
|
|
||
3 years ago
|
<!-- <div>-->
|
||
4 years ago
|
|
||
3 years ago
|
<!-- <v-btn
|
||
4 years ago
|
|
||
|
v-if="googleAuthEnabled"
|
||
4 years ago
|
:href="`${$axios.defaults.baseURL}/auth/google?state=${token}`" outlined
|
||
4 years ago
|
large elevation-10
|
||
|
block
|
||
|
color="blue">
|
||
|
<img :src="require('~/assets/img/gmail.png')"
|
||
|
class="img-responsive" alt="google"
|
||
|
width="24px">
|
||
|
<b> 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="github.png"
|
||
|
class="img-responsive" alt="google"
|
||
|
width="24px">
|
||
|
<b> Sign In with Github</b>
|
||
|
</v-btn>-->
|
||
|
|
||
3 years ago
|
<!-- </div>-->
|
||
4 years ago
|
</v-form>
|
||
3 years ago
|
<template v-else-if="type === 'none'">
|
||
|
<br />
|
||
4 years ago
|
<v-alert type="warning" outlined icon="mdi-alert">
|
||
|
<!-- <v-icon color="warning">mdi-alert</v-icon>-->
|
||
|
Authentication not configured in configuration
|
||
|
</v-alert>
|
||
|
</template>
|
||
|
</v-card>
|
||
|
|
||
3 years ago
|
<br />
|
||
4 years ago
|
|
||
|
<v-row justify="center">
|
||
3 years ago
|
<p class="text-right grey--text font-weight-light caption">
|
||
|
By signing up, you agree to
|
||
3 years ago
|
<span class="grey--text pointer" @click="openUrl('https://nocodb.com/policy-nocodb')"
|
||
|
><u>Terms of service</u></span
|
||
|
>
|
||
|
</p>
|
||
|
|
||
4 years ago
|
|
||
3 years ago
|
<!-- <div class="d-flex align-center mb-4 justify-center">
|
||
3 years ago
|
<v-checkbox v-model="subscribe" color="grey" dense hide-details class="mt-0 pt-0" />
|
||
3 years ago
|
<label class="caption grey--text font-weight-light">Subscribe to our weekly newsletter</label>
|
||
|
</div>-->
|
||
4 years ago
|
</v-row>
|
||
|
|
||
|
<!--<br>-->
|
||
|
<!--<h3>OR</h3>-->
|
||
|
<!--<br>-->
|
||
|
|
||
|
<!--<v-card class="pa-3 elevation-10" color="">-->
|
||
|
<!--<p>or sign up with one of these services</p>-->
|
||
|
<!--<a href="/api/auth/google?redirect_to=/"><img src="/btn_google_signin_dark_normal_web@2x.png"-->
|
||
|
<!--class="img-responsive" alt="google" wifth="128px"></a>-->
|
||
|
<!--<!–<br>–>-->
|
||
|
<!--<!–<a href="/api/auth/facebook?redirect_to=/"><img src="/facebook.png" class="img-responsive" alt="facebook"></a>–>-->
|
||
|
<!--</v-card>-->
|
||
|
<!--<br>-->
|
||
|
<!--<br>-->
|
||
|
</v-col>
|
||
|
</v-row>
|
||
|
</v-col>
|
||
|
</v-row>
|
||
|
</v-container>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
// const {shell} = require("electron").remote.require(
|
||
|
// "./libs"
|
||
|
// );
|
||
3 years ago
|
import { isEmail } from '@/helpers';
|
||
|
import passwordValidateMixin from '@/pages/user/authentication/passwordValidateMixin';
|
||
4 years ago
|
// import VueRecaptcha from 'vue-recaptcha';
|
||
|
|
||
|
export default {
|
||
|
components: {
|
||
|
// VueRecaptcha
|
||
|
},
|
||
3 years ago
|
directives: {},
|
||
3 years ago
|
mixins: [passwordValidateMixin],
|
||
3 years ago
|
layout: 'empty',
|
||
3 years ago
|
validate() {
|
||
3 years ago
|
return true;
|
||
3 years ago
|
},
|
||
|
props: {},
|
||
4 years ago
|
|
||
3 years ago
|
data() {
|
||
4 years ago
|
return {
|
||
3 years ago
|
subscribe: false,
|
||
3 years ago
|
isDev: process.env.NODE_ENV === 'dev',
|
||
4 years ago
|
|
||
|
dialog: false,
|
||
|
form: {
|
||
|
email: null,
|
||
3 years ago
|
password: null,
|
||
4 years ago
|
},
|
||
|
|
||
|
formRules: {
|
||
3 years ago
|
email: [v => !!v || 'E-mail is required', v => isEmail(v) || 'E-mail must be valid'],
|
||
|
password: [v => this.PasswordValidate(v) || this.passwordValidateMsg],
|
||
|
secret: [v => !!v || 'Required'],
|
||
4 years ago
|
},
|
||
|
formUtil: {
|
||
|
formErr: false,
|
||
|
formErrMsg: '',
|
||
|
valid: false,
|
||
|
valid1: false,
|
||
|
recpatcha: true,
|
||
|
e3: true,
|
||
|
e4: true,
|
||
|
passwordProgress: 0,
|
||
3 years ago
|
progressColorValue: 'red',
|
||
4 years ago
|
},
|
||
|
|
||
3 years ago
|
googleAuthUrl: '/api/auth/google',
|
||
3 years ago
|
facebookAuthUrl: '/api/auth/facebook',
|
||
|
};
|
||
4 years ago
|
},
|
||
3 years ago
|
head() {
|
||
3 years ago
|
return {
|
||
|
title: 'Sign Up | Noco',
|
||
3 years ago
|
meta: [{ hid: 'Sign Up To Noco', name: 'Sign Up To Noco', content: 'Sign Up To Noco' }],
|
||
|
};
|
||
3 years ago
|
},
|
||
|
computed: {
|
||
3 years ago
|
counter() {
|
||
3 years ago
|
return this.$store.getters['users/GtrCounter'];
|
||
4 years ago
|
},
|
||
3 years ago
|
displayName() {
|
||
3 years ago
|
return this.$store.getters['users/GtrUser'];
|
||
4 years ago
|
},
|
||
3 years ago
|
type() {
|
||
3 years ago
|
return this.$store.state.project.appInfo && this.$store.state.project.appInfo.authType;
|
||
4 years ago
|
},
|
||
3 years ago
|
firstUser() {
|
||
3 years ago
|
return this.$store.state.project.appInfo && this.$store.state.project.appInfo.firstUser;
|
||
4 years ago
|
},
|
||
3 years ago
|
googleAuthEnabled() {
|
||
3 years ago
|
return this.$store.state.project.appInfo && this.$store.state.project.appInfo.googleAuthEnabled;
|
||
3 years ago
|
},
|
||
3 years ago
|
token() {
|
||
3 years ago
|
return this.$route.params.token;
|
||
|
},
|
||
3 years ago
|
},
|
||
|
watch: {},
|
||
3 years ago
|
async created() {
|
||
3 years ago
|
// const type = await this.$store.dispatch('users/ActGetAuthType');
|
||
|
// this.type = type.type;
|
||
|
// this.firstUser = type.firstUser;
|
||
|
// let ckeditor = document.createElement('script');
|
||
|
// ckeditor.setAttribute('src',"https://www.google.com/recaptcha/api.js");
|
||
|
// document.head.appendChild(ckeditor);
|
||
|
},
|
||
3 years ago
|
mounted() {
|
||
3 years ago
|
// console.log(this.$route.query);
|
||
4 years ago
|
|
||
3 years ago
|
if ('buy' in this.$route.query) {
|
||
3 years ago
|
this.googleAuthUrl += '?redirect_to=/';
|
||
|
this.facebookAuthUrl += '?redirect_to=/';
|
||
3 years ago
|
} else {
|
||
3 years ago
|
this.googleAuthUrl += '?redirect_to=/';
|
||
|
this.facebookAuthUrl += '?redirect_to=/';
|
||
3 years ago
|
}
|
||
|
},
|
||
3 years ago
|
beforeDestroy() {},
|
||
3 years ago
|
methods: {
|
||
3 years ago
|
openUrl(url) {
|
||
3 years ago
|
window.open(url, '_blank');
|
||
3 years ago
|
},
|
||
3 years ago
|
openGoogleSiginInBrowser(e) {
|
||
3 years ago
|
e.preventDefault();
|
||
3 years ago
|
},
|
||
3 years ago
|
openGithubSiginInBrowser(e) {
|
||
3 years ago
|
e.preventDefault();
|
||
3 years ago
|
// shell.openExternal(process.env.auth.github.url)
|
||
|
},
|
||
3 years ago
|
onNormalVerify() {
|
||
3 years ago
|
this.formUtil.recpatcha = true;
|
||
3 years ago
|
// this.formUtil.recpatcha = false;
|
||
4 years ago
|
},
|
||
|
|
||
3 years ago
|
progressColor(num) {
|
||
3 years ago
|
this.formUtil.progressColorValue = ['error', 'warning', 'info', 'success'][Math.floor(num / 25)];
|
||
|
return this.formUtil.progressColorValue;
|
||
3 years ago
|
},
|
||
4 years ago
|
|
||
3 years ago
|
/* PasswordValidate(p) {
|
||
4 years ago
|
if (!p) {
|
||
3 years ago
|
this.passwordProgress = 0
|
||
4 years ago
|
this.passwordValidateMsg = 'Atleast 8 letters with one Uppercase, one number and one special letter'
|
||
3 years ago
|
return false
|
||
4 years ago
|
}
|
||
|
|
||
3 years ago
|
let msg = ''
|
||
|
let validation = true
|
||
|
let progress = 0
|
||
4 years ago
|
|
||
|
if (!(p.length >= 8)) {
|
||
|
msg += 'Atleast 8 letters. '
|
||
3 years ago
|
validation = validation && false
|
||
4 years ago
|
} else {
|
||
|
progress = Math.min(100, progress + 25)
|
||
|
}
|
||
|
|
||
3 years ago
|
if (!(p.match(/.*[A-Z].*!/))) {
|
||
4 years ago
|
msg += 'One Uppercase Letter. '
|
||
3 years ago
|
validation = validation && false
|
||
4 years ago
|
} else {
|
||
|
progress = Math.min(100, progress + 25)
|
||
|
}
|
||
|
|
||
3 years ago
|
if (!(p.match(/.*[0-9].*!/))) {
|
||
4 years ago
|
msg += 'One Number. '
|
||
3 years ago
|
validation = validation && false
|
||
4 years ago
|
} else {
|
||
|
progress = Math.min(100, progress + 25)
|
||
|
}
|
||
|
|
||
|
if (!(p.match(/[$&+,:;=?@#|'<>.^*()%!-]/))) {
|
||
|
msg += 'One special letter. '
|
||
3 years ago
|
validation = validation && false
|
||
4 years ago
|
} else {
|
||
|
progress = Math.min(100, progress + 25)
|
||
|
}
|
||
|
|
||
3 years ago
|
this.formUtil.passwordProgress = progress
|
||
4 years ago
|
// console.log('progress', progress);
|
||
|
// console.log('color', this.progressColor(this.formUtil.passwordProgress));
|
||
3 years ago
|
this.progressColorValue = this.progressColor(this.formUtil.passwordProgress)
|
||
4 years ago
|
|
||
3 years ago
|
this.formUtil.passwordValidateMsg = msg
|
||
4 years ago
|
|
||
3 years ago
|
// console.log('msg', msg, validation);
|
||
4 years ago
|
|
||
3 years ago
|
return validation
|
||
3 years ago
|
}, */
|
||
4 years ago
|
|
||
3 years ago
|
PlusCounter() {
|
||
3 years ago
|
this.$store.dispatch('ActPlusCounter');
|
||
4 years ago
|
},
|
||
|
|
||
3 years ago
|
async MtdOnSignup(e) {
|
||
3 years ago
|
e.preventDefault();
|
||
4 years ago
|
if (this.type === 'jwt') {
|
||
|
if (this.$refs.formType.validate()) {
|
||
3 years ago
|
// this.$nuxt.$loading.start()
|
||
|
// console.log('hello', this.form);
|
||
3 years ago
|
this.form.firstName = this.form.username;
|
||
|
this.form.lastName = this.form.username;
|
||
4 years ago
|
//
|
||
|
// await this.$recaptchaLoaded()
|
||
|
// const recaptchaToken = await this.$recaptcha('login')
|
||
3 years ago
|
const err = await this.$store.dispatch('users/ActSignUp', {
|
||
4 years ago
|
...this.form,
|
||
|
token: this.$route.params.token,
|
||
3 years ago
|
ignore_subscribe: !this.subscribe,
|
||
|
}); // recaptchaToken});
|
||
4 years ago
|
|
||
3 years ago
|
// console.log('in method signup', err);
|
||
4 years ago
|
|
||
3 years ago
|
await this.$store.dispatch('project/ActLoadProjectInfo');
|
||
4 years ago
|
|
||
|
if (err) {
|
||
3 years ago
|
this.formUtil.formErr = true;
|
||
|
this.formUtil.formErrMsg = err.data.msg;
|
||
|
return;
|
||
4 years ago
|
}
|
||
|
|
||
3 years ago
|
// this.$nuxt.$loading.finish()
|
||
4 years ago
|
}
|
||
|
} else if (this.type === 'masterKey') {
|
||
3 years ago
|
const valid = await this.$store.dispatch('users/ActVerifyMasterKey', this.form.secret);
|
||
4 years ago
|
if (!valid) {
|
||
3 years ago
|
this.formUtil.formErr = true;
|
||
|
this.formUtil.formErrMsg = 'Invalid admin secret';
|
||
|
return;
|
||
4 years ago
|
}
|
||
3 years ago
|
this.$store.commit('users/MutMasterKey', this.form.secret);
|
||
4 years ago
|
}
|
||
|
|
||
|
if ('redirect_to' in this.$route.query) {
|
||
3 years ago
|
this.$router.push(this.$route.query.redirect_to);
|
||
4 years ago
|
} else {
|
||
3 years ago
|
this.$router.push('/projects?toast');
|
||
4 years ago
|
}
|
||
|
},
|
||
|
|
||
3 years ago
|
MtdOnReset() {
|
||
3 years ago
|
// console.log('in method reset');
|
||
4 years ago
|
},
|
||
|
|
||
3 years ago
|
async MtdOnSignupGoogle(e) {
|
||
3 years ago
|
await this.$store.dispatch('users/ActAuthGoogle');
|
||
3 years ago
|
// console.log('MtdOnSignupGoogle', err);
|
||
3 years ago
|
},
|
||
4 years ago
|
},
|
||
|
|
||
3 years ago
|
beforeCreated() {},
|
||
|
destroy() {},
|
||
|
};
|
||
4 years ago
|
</script>
|
||
|
|
||
3 years ago
|
<style scoped></style>
|
||
4 years ago
|
<!--
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
|
||
|
*
|
||
|
* @author Naveen MR <oof1lab@gmail.com>
|
||
|
* @author Pranav C Balan <pranavxc@gmail.com>
|
||
4 years ago
|
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
|
||
3 years ago
|
* @author Alejandro Moreno <info@pixplix.com>
|
||
4 years ago
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|