refactor: Activate Registration

This commit is contained in:
Moriz Wahl 2021-10-14 17:19:41 +02:00
parent ab684c22b8
commit f8ddb53dba
7 changed files with 16 additions and 30 deletions

View File

@ -1,4 +1,3 @@
ALLOW_REGISTER=true
GRAPHQL_URI=http://localhost:4000/graphql
DEFAULT_PUBLISHER_ID=2896
//BUILD_COMMIT=0000000

View File

@ -22,9 +22,7 @@ const server = {
GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost:4000/graphql',
}
const options = {
ALLOW_REGISTER: process.env.ALLOW_REGISTER !== 'false',
}
const options = {}
const CONFIG = {
...version,

View File

@ -1,7 +1,6 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
import CONFIG from '../config'
Vue.use(VueRouter)
@ -21,11 +20,4 @@ const router = new VueRouter({
},
})
if (CONFIG.ALLOW_REGISTER) {
router.addRoute({
path: '/register',
component: () => import('../views/Pages/Register.vue'),
})
}
export default router

View File

@ -44,19 +44,13 @@ describe('router', () => {
})
})
describe('register page', () => {
it('is not present', () => {
expect(routes.find((r) => r.path === '/register')).toBe(undefined)
})
})
describe('routes', () => {
it('has "/login" as default', () => {
expect(routes.find((r) => r.path === '/').redirect()).toEqual({ path: '/login' })
})
it('has twelve routes defined', () => {
expect(routes).toHaveLength(12)
expect(routes).toHaveLength(13)
})
describe('overview', () => {
@ -99,6 +93,13 @@ describe('router', () => {
})
})
describe('register', () => {
it('loads the "register" component', async () => {
const component = await routes.find((r) => r.path === '/register').component()
expect(component.default.name).toBe('register')
})
})
describe('thx', () => {
const thx = routes.find((r) => r.path === '/thx/:comingFrom')

View File

@ -32,6 +32,10 @@ const routes = [
path: '/login',
component: () => import('../views/Pages/Login.vue'),
},
{
path: '/register',
component: () => import('../views/Pages/Register.vue'),
},
{
path: '/thx/:comingFrom',
component: () => import('../views/Pages/thx.vue'),

View File

@ -136,9 +136,7 @@ describe('Login', () => {
})
it('links to /register when clicking "Create new account"', () => {
expect(wrapper.findAllComponents(RouterLinkStub).at(1).props().to).toBe(
'/register-community',
)
expect(wrapper.findAllComponents(RouterLinkStub).at(1).props().to).toBe('/register')
})
})

View File

@ -48,12 +48,8 @@
{{ $t('settings.password.forgot_pwd') }}
</router-link>
</b-col>
<b-col
cols="6"
class="text-center text-sm-right col-12 col-sm-6"
v-show="allowRegister"
>
<router-link to="/register-community" class="mt-3">
<b-col cols="6" class="text-center text-sm-right col-12 col-sm-6">
<router-link to="/register" class="mt-3">
{{ $t('site.login.new_wallet') }}
</router-link>
</b-col>
@ -64,7 +60,6 @@
</div>
</template>
<script>
import CONFIG from '../../config'
import InputPassword from '../../components/Inputs/InputPassword'
import InputEmail from '../../components/Inputs/InputEmail'
import { login, communityInfo } from '../../graphql/queries'
@ -81,7 +76,6 @@ export default {
email: '',
password: '',
},
allowRegister: CONFIG.ALLOW_REGISTER,
passwordVisible: false,
}
},