Merge pull request #978 from gradido/activate-registration

refactor: Activate Registration
This commit is contained in:
Moriz Wahl 2021-10-15 10:59:47 +02:00 committed by GitHub
commit d73092ddcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 21 additions and 31 deletions

View File

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

View File

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

View File

@ -1,7 +1,6 @@
import Vue from 'vue' import Vue from 'vue'
import VueRouter from 'vue-router' import VueRouter from 'vue-router'
import routes from './routes' import routes from './routes'
import CONFIG from '../config'
Vue.use(VueRouter) 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 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', () => { describe('routes', () => {
it('has "/login" as default', () => { it('has "/login" as default', () => {
expect(routes.find((r) => r.path === '/').redirect()).toEqual({ path: '/login' }) expect(routes.find((r) => r.path === '/').redirect()).toEqual({ path: '/login' })
}) })
it('has twelve routes defined', () => { it('has twelve routes defined', () => {
expect(routes).toHaveLength(12) expect(routes).toHaveLength(13)
}) })
describe('overview', () => { 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', () => { describe('thx', () => {
const thx = routes.find((r) => r.path === '/thx/:comingFrom') const thx = routes.find((r) => r.path === '/thx/:comingFrom')

View File

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

View File

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

View File

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

View File

@ -146,6 +146,7 @@ describe('Register', () => {
}) })
}) })
/*
describe('link Choose another community', () => { describe('link Choose another community', () => {
it('has a link "Choose another community"', () => { it('has a link "Choose another community"', () => {
expect(wrapper.find('.test-button-another-community').text()).toEqual( expect(wrapper.find('.test-button-another-community').text()).toEqual(
@ -157,6 +158,7 @@ describe('Register', () => {
expect(wrapper.find('.test-button-another-community').props().to).toBe('/select-community') expect(wrapper.find('.test-button-another-community').props().to).toBe('/select-community')
}) })
}) })
*/
describe('API calls', () => { describe('API calls', () => {
beforeEach(() => { beforeEach(() => {

View File

@ -125,7 +125,7 @@
<div class="text-center"> <div class="text-center">
<div class="text-center"> <div class="text-center">
<router-link class="test-button-back" to="/login"> <router-link class="test-button-back" to="/login">
<b-button variant="outline-secondary"> <b-button variant="outline-secondary" class="mr-4">
{{ $t('back') }} {{ $t('back') }}
</b-button> </b-button>
</router-link> </router-link>
@ -145,6 +145,7 @@
</b-col> </b-col>
</b-row> </b-row>
</b-container> </b-container>
<!--
<div class="text-center pt-4"> <div class="text-center pt-4">
<router-link class="test-button-another-community" to="/select-community"> <router-link class="test-button-another-community" to="/select-community">
<b-button variant="outline-secondary"> <b-button variant="outline-secondary">
@ -152,6 +153,7 @@
</b-button> </b-button>
</router-link> </router-link>
</div> </div>
-->
</div> </div>
</template> </template>
<script> <script>