mirror of
https://github.com/IT4Change/gradido.git
synced 2026-04-06 01:25:28 +00:00
Merge branch 'master' into localize-datetime-admin
This commit is contained in:
commit
ec0df5be14
@ -15,7 +15,7 @@ const apolloQueryMock = jest.fn().mockResolvedValue({
|
|||||||
decayDuration: 0,
|
decayDuration: 0,
|
||||||
memo: 'Testing',
|
memo: 'Testing',
|
||||||
transactionId: 1,
|
transactionId: 1,
|
||||||
name: 'Bibi',
|
name: 'Gradido Akademie',
|
||||||
email: 'bibi@bloxberg.de',
|
email: 'bibi@bloxberg.de',
|
||||||
date: new Date(),
|
date: new Date(),
|
||||||
decay: {
|
decay: {
|
||||||
@ -34,7 +34,7 @@ const apolloQueryMock = jest.fn().mockResolvedValue({
|
|||||||
decayDuration: 0,
|
decayDuration: 0,
|
||||||
memo: 'Testing 2',
|
memo: 'Testing 2',
|
||||||
transactionId: 2,
|
transactionId: 2,
|
||||||
name: 'Bibi',
|
name: 'Gradido Akademie',
|
||||||
email: 'bibi@bloxberg.de',
|
email: 'bibi@bloxberg.de',
|
||||||
date: new Date(),
|
date: new Date(),
|
||||||
decay: {
|
decay: {
|
||||||
@ -53,6 +53,7 @@ const apolloQueryMock = jest.fn().mockResolvedValue({
|
|||||||
const toastedErrorMock = jest.fn()
|
const toastedErrorMock = jest.fn()
|
||||||
|
|
||||||
const mocks = {
|
const mocks = {
|
||||||
|
$d: jest.fn((t) => t),
|
||||||
$t: jest.fn((t) => t),
|
$t: jest.fn((t) => t),
|
||||||
$apollo: {
|
$apollo: {
|
||||||
query: apolloQueryMock,
|
query: apolloQueryMock,
|
||||||
@ -64,6 +65,7 @@ const mocks = {
|
|||||||
|
|
||||||
const propsData = {
|
const propsData = {
|
||||||
userId: 1,
|
userId: 1,
|
||||||
|
fields: ['date', 'balance', 'name', 'memo', 'decay'],
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('CreationTransactionListFormular', () => {
|
describe('CreationTransactionListFormular', () => {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="component-creation-transaction-list">
|
<div class="component-creation-transaction-list">
|
||||||
{{ $t('transactionlist.title') }}
|
{{ $t('transactionlist.title') }}
|
||||||
<b-table striped hover :items="items"></b-table>
|
<b-table striped hover :fields="fields" :items="items"></b-table>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@ -13,6 +13,35 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'date',
|
||||||
|
label: this.$t('transactionlist.date'),
|
||||||
|
formatter: (value, key, item) => {
|
||||||
|
return this.$d(new Date(value))
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'balance',
|
||||||
|
label: this.$t('transactionlist.amount'),
|
||||||
|
formatter: (value, key, item) => {
|
||||||
|
return `${value} GDD`
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ key: 'name', label: this.$t('transactionlist.community') },
|
||||||
|
{ key: 'memo', label: this.$t('transactionlist.memo') },
|
||||||
|
{
|
||||||
|
key: 'decay',
|
||||||
|
label: this.$t('transactionlist.decay'),
|
||||||
|
formatter: (value, key, item) => {
|
||||||
|
if (value && value.balance >= 0) {
|
||||||
|
return value.balance
|
||||||
|
} else {
|
||||||
|
return '0'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
items: [],
|
items: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -12,6 +12,9 @@
|
|||||||
"select_value": "Betrag auswählen",
|
"select_value": "Betrag auswählen",
|
||||||
"submit_creation": "Schöpfung einreichen",
|
"submit_creation": "Schöpfung einreichen",
|
||||||
"toasted": "Offene Schöpfung ({value} GDD) für {email} wurde gespeichert und liegt zur Bestätigung bereit",
|
"toasted": "Offene Schöpfung ({value} GDD) für {email} wurde gespeichert und liegt zur Bestätigung bereit",
|
||||||
|
"toasted_created": "Schöpfung wurde erfolgreich gespeichert",
|
||||||
|
"toasted_default": "`Fall {event} wird nicht unterstützt`",
|
||||||
|
"toasted_delete": "Offene Schöpfung wurde gelöscht",
|
||||||
"toasted_update": "`Offene Schöpfung {value} GDD) für {email} wurde geändert und liegt zur Bestätigung bereit",
|
"toasted_update": "`Offene Schöpfung {value} GDD) für {email} wurde geändert und liegt zur Bestätigung bereit",
|
||||||
"update_creation": "Schöpfung aktualisieren"
|
"update_creation": "Schöpfung aktualisieren"
|
||||||
},
|
},
|
||||||
@ -53,6 +56,11 @@
|
|||||||
"remove": "Entfernen",
|
"remove": "Entfernen",
|
||||||
"transaction": "Transaktion",
|
"transaction": "Transaktion",
|
||||||
"transactionlist": {
|
"transactionlist": {
|
||||||
|
"amount": "Betrag",
|
||||||
|
"community": "Gemeinschaft",
|
||||||
|
"date": "Datum",
|
||||||
|
"decay": "Vergänglichkeit",
|
||||||
|
"memo": "Nachricht",
|
||||||
"title": "Alle geschöpften Transaktionen für den Nutzer"
|
"title": "Alle geschöpften Transaktionen für den Nutzer"
|
||||||
},
|
},
|
||||||
"unregistered_emails": "Nur unregistrierte Nutzer",
|
"unregistered_emails": "Nur unregistrierte Nutzer",
|
||||||
|
|||||||
@ -12,6 +12,9 @@
|
|||||||
"select_value": "Select amount",
|
"select_value": "Select amount",
|
||||||
"submit_creation": "Submit creation",
|
"submit_creation": "Submit creation",
|
||||||
"toasted": "Open creation ({value} GDD) for {email} has been saved and is ready for confirmation.",
|
"toasted": "Open creation ({value} GDD) for {email} has been saved and is ready for confirmation.",
|
||||||
|
"toasted_created": "Creation has been successfully saved",
|
||||||
|
"toasted_default": "`Case {event} is not supported`",
|
||||||
|
"toasted_delete": "Open creation has been deleted",
|
||||||
"toasted_update": "Open creation {value} GDD) for {email} has been changed and is ready for confirmation.",
|
"toasted_update": "Open creation {value} GDD) for {email} has been changed and is ready for confirmation.",
|
||||||
"update_creation": "Creation update"
|
"update_creation": "Creation update"
|
||||||
},
|
},
|
||||||
@ -53,6 +56,11 @@
|
|||||||
"remove": "Remove",
|
"remove": "Remove",
|
||||||
"transaction": "Transaction",
|
"transaction": "Transaction",
|
||||||
"transactionlist": {
|
"transactionlist": {
|
||||||
|
"amount": "Amount",
|
||||||
|
"community": "Community",
|
||||||
|
"date": "Date",
|
||||||
|
"decay": "Decay",
|
||||||
|
"memo": "Message",
|
||||||
"title": "All creation-transactions for the user"
|
"title": "All creation-transactions for the user"
|
||||||
},
|
},
|
||||||
"unregistered_emails": "Only unregistered users",
|
"unregistered_emails": "Only unregistered users",
|
||||||
|
|||||||
@ -41,6 +41,9 @@ Vue.use(Toasted, {
|
|||||||
|
|
||||||
addNavigationGuards(router, store, apolloProvider.defaultClient, i18n)
|
addNavigationGuards(router, store, apolloProvider.defaultClient, i18n)
|
||||||
|
|
||||||
|
i18n.locale =
|
||||||
|
store.state.moderator && store.state.moderator.language ? store.state.moderator.language : 'en'
|
||||||
|
|
||||||
new Vue({
|
new Vue({
|
||||||
router,
|
router,
|
||||||
store,
|
store,
|
||||||
|
|||||||
@ -13,7 +13,15 @@ jest.mock('vue')
|
|||||||
jest.mock('vue-apollo')
|
jest.mock('vue-apollo')
|
||||||
jest.mock('vuex')
|
jest.mock('vuex')
|
||||||
jest.mock('vue-i18n')
|
jest.mock('vue-i18n')
|
||||||
jest.mock('./store/store')
|
jest.mock('./store/store', () => {
|
||||||
|
return {
|
||||||
|
state: {
|
||||||
|
moderator: {
|
||||||
|
language: 'es',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
jest.mock('./i18n')
|
jest.mock('./i18n')
|
||||||
jest.mock('./router/router')
|
jest.mock('./router/router')
|
||||||
|
|
||||||
@ -95,4 +103,8 @@ describe('main', () => {
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('sets the locale from store', () => {
|
||||||
|
expect(i18n.locale).toBe('es')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -123,7 +123,7 @@ describe('CreationConfirm', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('toasts a success message', () => {
|
it('toasts a success message', () => {
|
||||||
expect(toastedSuccessMock).toBeCalledWith('Pending Creation has been deleted')
|
expect(toastedSuccessMock).toBeCalledWith('creation_form.toasted_delete')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ describe('CreationConfirm', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('toasts a success message', () => {
|
it('toasts a success message', () => {
|
||||||
expect(toastedSuccessMock).toBeCalledWith('Pending Creation has been deleted')
|
expect(toastedSuccessMock).toBeCalledWith('creation_form.toasted_created')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ describe('CreationConfirm', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('toasts an error message', () => {
|
it('toasts an error message', () => {
|
||||||
expect(toastedErrorMock).toBeCalledWith('Case confirm is not supported')
|
expect(toastedErrorMock).toBeCalledWith('creation_form.toasted_default')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -66,7 +66,7 @@ export default {
|
|||||||
index = this.confirmResult.indexOf(findArr)
|
index = this.confirmResult.indexOf(findArr)
|
||||||
this.confirmResult.splice(index, 1)
|
this.confirmResult.splice(index, 1)
|
||||||
this.$store.commit('openCreationsMinus', 1)
|
this.$store.commit('openCreationsMinus', 1)
|
||||||
this.$toasted.success('Pending Creation has been deleted')
|
this.$toasted.success(this.$t('creation_form.toasted_delete'))
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.$toasted.error(error.message)
|
this.$toasted.error(error.message)
|
||||||
@ -75,10 +75,10 @@ export default {
|
|||||||
case 'confirmed':
|
case 'confirmed':
|
||||||
this.confirmResult.splice(index, 1)
|
this.confirmResult.splice(index, 1)
|
||||||
this.$store.commit('openCreationsMinus', 1)
|
this.$store.commit('openCreationsMinus', 1)
|
||||||
this.$toasted.success('Pending Creation has been deleted')
|
this.$toasted.success(this.$t('creation_form.toasted_created'))
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
this.$toasted.error('Case ' + event + ' is not supported')
|
this.$toasted.error(this.$t('creation_form.toasted_default', { event }))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getPendingCreations() {
|
getPendingCreations() {
|
||||||
|
|||||||
@ -27,9 +27,9 @@ EMAIL_LINK_SETPASSWORD=$EMAIL_LINK_SETPASSWORD
|
|||||||
#KLICKTIPP_APIKEY_DE=
|
#KLICKTIPP_APIKEY_DE=
|
||||||
#KLICKTIPP_APIKEY_EN=
|
#KLICKTIPP_APIKEY_EN=
|
||||||
#KLICKTIPP=true
|
#KLICKTIPP=true
|
||||||
COMMUNITY_NAME=
|
COMMUNITY_NAME=$COMMUNITY_NAME
|
||||||
COMMUNITY_URL=
|
COMMUNITY_URL=$COMMUNITY_URL
|
||||||
COMMUNITY_REGISTER_URL=
|
COMMUNITY_REGISTER_URL=$COMMUNITY_REGISTER_URL
|
||||||
COMMUNITY_DESCRIPTION=
|
COMMUNITY_DESCRIPTION=$COMMUNITY_DESCRIPTION
|
||||||
|
|
||||||
WEBHOOK_ELOPAGE_SECRET=$WEBHOOK_ELOPAGE_SECRET
|
WEBHOOK_ELOPAGE_SECRET=$WEBHOOK_ELOPAGE_SECRET
|
||||||
@ -8,16 +8,28 @@ import { RIGHTS } from '../../auth/RIGHTS'
|
|||||||
import { ServerUserRepository } from '../../typeorm/repository/ServerUser'
|
import { ServerUserRepository } from '../../typeorm/repository/ServerUser'
|
||||||
import { getCustomRepository } from 'typeorm'
|
import { getCustomRepository } from 'typeorm'
|
||||||
import { UserRepository } from '../../typeorm/repository/User'
|
import { UserRepository } from '../../typeorm/repository/User'
|
||||||
|
import { INALIENABLE_RIGHTS } from '../../auth/INALIENABLE_RIGHTS'
|
||||||
|
|
||||||
const isAuthorized: AuthChecker<any> = async ({ context }, rights) => {
|
const isAuthorized: AuthChecker<any> = async ({ context }, rights) => {
|
||||||
context.role = ROLE_UNAUTHORIZED // unauthorized user
|
context.role = ROLE_UNAUTHORIZED // unauthorized user
|
||||||
|
|
||||||
// Do we have a token?
|
// Do we have a token?
|
||||||
if (context.token) {
|
if (context.token) {
|
||||||
|
// Decode the token
|
||||||
const decoded = decode(context.token)
|
const decoded = decode(context.token)
|
||||||
if (!decoded) {
|
if (!decoded) {
|
||||||
// we always throw on an invalid token
|
// Are all rights requested public?
|
||||||
throw new Error('403.13 - Client certificate revoked')
|
const isInalienable = (<RIGHTS[]>rights).reduce(
|
||||||
|
(acc, right) => acc && INALIENABLE_RIGHTS.includes(right),
|
||||||
|
true,
|
||||||
|
)
|
||||||
|
if (isInalienable) {
|
||||||
|
// If public dont throw and permit access
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
// Throw on a protected route
|
||||||
|
throw new Error('403.13 - Client certificate revoked')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Set context pubKey
|
// Set context pubKey
|
||||||
context.pubKey = Buffer.from(decoded.pubKey).toString('hex')
|
context.pubKey = Buffer.from(decoded.pubKey).toString('hex')
|
||||||
|
|||||||
@ -30,6 +30,11 @@ TYPEORM_LOGGING_RELATIVE_PATH=../deployment/bare_metal/log/typeorm.backend.log
|
|||||||
|
|
||||||
WEBHOOK_ELOPAGE_SECRET=secret
|
WEBHOOK_ELOPAGE_SECRET=secret
|
||||||
|
|
||||||
|
COMMUNITY_NAME=Gradido Development Stage1
|
||||||
|
COMMUNITY_URL=https://stage1.gradido.net/
|
||||||
|
COMMUNITY_REGISTER_URL=https://stage1.gradido.net/register
|
||||||
|
COMMUNITY_DESCRIPTION=Gradido Development Stage1 Test Community
|
||||||
|
|
||||||
# frontend
|
# frontend
|
||||||
GRAPHQL_URI=https://stage1.gradido.net/graphql
|
GRAPHQL_URI=https://stage1.gradido.net/graphql
|
||||||
ADMIN_AUTH_URL=https://stage1.gradido.net/admin/authenticate?token={token}
|
ADMIN_AUTH_URL=https://stage1.gradido.net/admin/authenticate?token={token}
|
||||||
|
|||||||
@ -24,8 +24,12 @@
|
|||||||
<b-row class="mb-2">
|
<b-row class="mb-2">
|
||||||
<b-col>
|
<b-col>
|
||||||
<input-password
|
<input-password
|
||||||
:rules="{ samePassword: value.password }"
|
:rules="{
|
||||||
|
required: true,
|
||||||
|
samePassword: value.password,
|
||||||
|
}"
|
||||||
:label="register ? $t('form.passwordRepeat') : $t('form.password_new_repeat')"
|
:label="register ? $t('form.passwordRepeat') : $t('form.password_new_repeat')"
|
||||||
|
:immediate="true"
|
||||||
:name="createId(register ? $t('form.passwordRepeat') : $t('form.password_new_repeat'))"
|
:name="createId(register ? $t('form.passwordRepeat') : $t('form.password_new_repeat'))"
|
||||||
:placeholder="register ? $t('form.passwordRepeat') : $t('form.password_new_repeat')"
|
:placeholder="register ? $t('form.passwordRepeat') : $t('form.password_new_repeat')"
|
||||||
v-model="passwordRepeat"
|
v-model="passwordRepeat"
|
||||||
|
|||||||
@ -12,7 +12,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { localeChanged } from 'vee-validate'
|
|
||||||
import locales from '../locales/'
|
import locales from '../locales/'
|
||||||
import { updateUserInfos } from '../graphql/mutations'
|
import { updateUserInfos } from '../graphql/mutations'
|
||||||
|
|
||||||
@ -26,10 +25,8 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setLocale(locale) {
|
setLocale(locale) {
|
||||||
this.$i18n.locale = locale
|
this.$store.commit('language', locale)
|
||||||
this.$store.commit('language', this.$i18n.locale)
|
|
||||||
this.currentLanguage = this.getLocaleObject(locale)
|
this.currentLanguage = this.getLocaleObject(locale)
|
||||||
localeChanged(locale)
|
|
||||||
},
|
},
|
||||||
async saveLocale(locale) {
|
async saveLocale(locale) {
|
||||||
// if (this.$i18n.locale === locale) return
|
// if (this.$i18n.locale === locale) return
|
||||||
|
|||||||
@ -7,6 +7,7 @@ const propsData = {
|
|||||||
balance: 1234,
|
balance: 1234,
|
||||||
visible: false,
|
visible: false,
|
||||||
elopageUri: 'https://elopage.com',
|
elopageUri: 'https://elopage.com',
|
||||||
|
pending: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
const mocks = {
|
const mocks = {
|
||||||
@ -20,6 +21,7 @@ const mocks = {
|
|||||||
isAdmin: true,
|
isAdmin: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
$n: jest.fn((n) => n),
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('Navbar', () => {
|
describe('Navbar', () => {
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<b-navbar-nav class="ml-auto" is-nav>
|
<b-navbar-nav class="ml-auto" is-nav>
|
||||||
<b-nav-item>{{ balance }} GDD</b-nav-item>
|
<b-nav-item>{{ pending ? '—' : $n(balance, 'decimal') }} GDD</b-nav-item>
|
||||||
<b-nav-item to="/profile" right class="d-none d-sm-none d-md-none d-lg-flex shadow-lg">
|
<b-nav-item to="/profile" right class="d-none d-sm-none d-md-none d-lg-flex shadow-lg">
|
||||||
<small>
|
<small>
|
||||||
{{ $store.state.firstName }} {{ $store.state.lastName }},
|
{{ $store.state.firstName }} {{ $store.state.lastName }},
|
||||||
@ -87,6 +87,10 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
|
pending: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
<p></p>
|
<p></p>
|
||||||
<div class="mb-6">
|
<div class="mb-6">
|
||||||
<b-nav vertical class="w-200">
|
<b-nav vertical class="w-200">
|
||||||
<b-nav-item to="/overview" class="mb-3" active>
|
<b-nav-item to="/overview" class="mb-3">
|
||||||
<b-icon icon="house" aria-hidden="true"></b-icon>
|
<b-icon icon="house" aria-hidden="true"></b-icon>
|
||||||
{{ $t('overview') }}
|
{{ $t('overview') }}
|
||||||
</b-nav-item>
|
</b-nav-item>
|
||||||
@ -52,3 +52,9 @@ export default {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style>
|
||||||
|
#component-sidebar .active,
|
||||||
|
.component-navbar .active {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"admin_area": "Adminbereich",
|
"admin_area": "Adminbereich",
|
||||||
|
"advanced-calculation": "Vorausberechnung",
|
||||||
"back": "Zurück",
|
"back": "Zurück",
|
||||||
"community": {
|
"community": {
|
||||||
"choose-another-community": "Eine andere Gemeinschaft auswählen",
|
"choose-another-community": "Eine andere Gemeinschaft auswählen",
|
||||||
@ -197,7 +198,7 @@
|
|||||||
},
|
},
|
||||||
"thx": {
|
"thx": {
|
||||||
"activateEmail": "Dein Konto wurde noch nicht aktiviert. Bitte überprüfe deine E-Mail und klicke den Aktivierungslink!",
|
"activateEmail": "Dein Konto wurde noch nicht aktiviert. Bitte überprüfe deine E-Mail und klicke den Aktivierungslink!",
|
||||||
"checkEmail": "Deine E-Mail wurde erfolgreich verifiziert.",
|
"checkEmail": "Deine E-Mail wurde erfolgreich verifiziert. Du kannst dich jetzt anmelden.",
|
||||||
"email": "Wir haben dir eine E-Mail gesendet.",
|
"email": "Wir haben dir eine E-Mail gesendet.",
|
||||||
"emailActivated": "Danke dass Du deine E-Mail bestätigt hast.",
|
"emailActivated": "Danke dass Du deine E-Mail bestätigt hast.",
|
||||||
"errorTitle": "Achtung!",
|
"errorTitle": "Achtung!",
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"admin_area": "Admin Area",
|
"admin_area": "Admin Area",
|
||||||
|
"advanced-calculation": "Advanced calculation",
|
||||||
"back": "Back",
|
"back": "Back",
|
||||||
"community": {
|
"community": {
|
||||||
"choose-another-community": "Choose another community",
|
"choose-another-community": "Choose another community",
|
||||||
@ -197,7 +198,7 @@
|
|||||||
},
|
},
|
||||||
"thx": {
|
"thx": {
|
||||||
"activateEmail": "Your account has not been activated yet, please check your emails and click the activation link!",
|
"activateEmail": "Your account has not been activated yet, please check your emails and click the activation link!",
|
||||||
"checkEmail": "Your email has been successfully verified.",
|
"checkEmail": "Your email has been successfully verified. You can sign in now.",
|
||||||
"email": "We have sent you an email.",
|
"email": "We have sent you an email.",
|
||||||
"emailActivated": "Thank you your email has been activated.",
|
"emailActivated": "Thank you your email has been activated.",
|
||||||
"errorTitle": "Attention!",
|
"errorTitle": "Attention!",
|
||||||
|
|||||||
@ -28,7 +28,7 @@ Vue.toasted.register(
|
|||||||
|
|
||||||
loadAllRules(i18n)
|
loadAllRules(i18n)
|
||||||
|
|
||||||
addNavigationGuards(router, store, apolloProvider.defaultClient, i18n)
|
addNavigationGuards(router, store, apolloProvider.defaultClient)
|
||||||
|
|
||||||
if (!store) {
|
if (!store) {
|
||||||
setTimeout(
|
setTimeout(
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { verifyLogin } from '../graphql/queries'
|
import { verifyLogin } from '../graphql/queries'
|
||||||
|
|
||||||
const addNavigationGuards = (router, store, apollo, i18n) => {
|
const addNavigationGuards = (router, store, apollo) => {
|
||||||
// handle publisherId
|
// handle publisherId
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
const publisherId = to.query.pid
|
const publisherId = to.query.pid
|
||||||
@ -21,7 +21,6 @@ const addNavigationGuards = (router, store, apollo, i18n) => {
|
|||||||
fetchPolicy: 'network-only',
|
fetchPolicy: 'network-only',
|
||||||
})
|
})
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
i18n.locale = result.data.verifyLogin.language
|
|
||||||
store.dispatch('login', result.data.verifyLogin)
|
store.dispatch('login', result.data.verifyLogin)
|
||||||
next({ path: '/overview' })
|
next({ path: '/overview' })
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,11 +1,15 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import createPersistedState from 'vuex-persistedstate'
|
import createPersistedState from 'vuex-persistedstate'
|
||||||
|
import { localeChanged } from 'vee-validate'
|
||||||
|
import i18n from '../i18n.js'
|
||||||
|
|
||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
|
|
||||||
export const mutations = {
|
export const mutations = {
|
||||||
language: (state, language) => {
|
language: (state, language) => {
|
||||||
|
i18n.locale = language
|
||||||
|
localeChanged(language)
|
||||||
state.language = language
|
state.language = language
|
||||||
},
|
},
|
||||||
email: (state, email) => {
|
email: (state, email) => {
|
||||||
|
|||||||
@ -1,8 +1,18 @@
|
|||||||
import { mutations, actions } from './store'
|
import { mutations, actions } from './store'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
import i18n from '../i18n.js'
|
||||||
|
import { localeChanged } from 'vee-validate'
|
||||||
|
|
||||||
jest.mock('vuex')
|
jest.mock('vuex')
|
||||||
|
jest.mock('../i18n.js')
|
||||||
|
jest.mock('vee-validate', () => {
|
||||||
|
return {
|
||||||
|
localeChanged: jest.fn(),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
i18n.locale = 'blubb'
|
||||||
|
|
||||||
const {
|
const {
|
||||||
language,
|
language,
|
||||||
@ -29,6 +39,14 @@ describe('Vuex store', () => {
|
|||||||
language(state, 'de')
|
language(state, 'de')
|
||||||
expect(state.language).toEqual('de')
|
expect(state.language).toEqual('de')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('sets the i18n locale', () => {
|
||||||
|
expect(i18n.locale).toBe('de')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('calls localChanged of vee-validate', () => {
|
||||||
|
expect(localeChanged).toBeCalledWith('de')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('email', () => {
|
describe('email', () => {
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
class="main-navbar"
|
class="main-navbar"
|
||||||
:balance="balance"
|
:balance="balance"
|
||||||
:visible="visible"
|
:visible="visible"
|
||||||
|
:pending="pending"
|
||||||
:elopageUri="elopageUri"
|
:elopageUri="elopageUri"
|
||||||
@set-visible="setVisible"
|
@set-visible="setVisible"
|
||||||
@admin="admin"
|
@admin="admin"
|
||||||
|
|||||||
@ -191,7 +191,6 @@
|
|||||||
import InputEmail from '../../components/Inputs/InputEmail.vue'
|
import InputEmail from '../../components/Inputs/InputEmail.vue'
|
||||||
import LanguageSwitchSelect from '../../components/LanguageSwitchSelect.vue'
|
import LanguageSwitchSelect from '../../components/LanguageSwitchSelect.vue'
|
||||||
import { createUser } from '../../graphql/mutations'
|
import { createUser } from '../../graphql/mutations'
|
||||||
import { localeChanged } from 'vee-validate'
|
|
||||||
import { getCommunityInfoMixin } from '../../mixins/getCommunityInfo'
|
import { getCommunityInfoMixin } from '../../mixins/getCommunityInfo'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -218,8 +217,6 @@ export default {
|
|||||||
updateLanguage(e) {
|
updateLanguage(e) {
|
||||||
this.language = e
|
this.language = e
|
||||||
this.$store.commit('language', this.language)
|
this.$store.commit('language', this.language)
|
||||||
this.$i18n.locale = this.language
|
|
||||||
localeChanged(this.language)
|
|
||||||
},
|
},
|
||||||
getValidationState({ dirty, validated, valid = null }) {
|
getValidationState({ dirty, validated, valid = null }) {
|
||||||
return dirty || validated ? valid : null
|
return dirty || validated ? valid : null
|
||||||
|
|||||||
@ -15,54 +15,48 @@ const stubs = {
|
|||||||
RouterLink: RouterLinkStub,
|
RouterLink: RouterLinkStub,
|
||||||
}
|
}
|
||||||
|
|
||||||
const createMockObject = (comingFrom) => {
|
const mocks = {
|
||||||
return {
|
$i18n: {
|
||||||
localVue,
|
locale: 'en',
|
||||||
mocks: {
|
},
|
||||||
$i18n: {
|
$t: jest.fn((t) => t),
|
||||||
locale: 'en',
|
$route: {
|
||||||
},
|
params: {
|
||||||
$t: jest.fn((t) => t),
|
optin: '123',
|
||||||
$route: {
|
|
||||||
params: {
|
|
||||||
optin: '123',
|
|
||||||
comingFrom,
|
|
||||||
},
|
|
||||||
path: {
|
|
||||||
includes: (t) => t,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
$toasted: {
|
|
||||||
global: {
|
|
||||||
error: toasterMock,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
$router: {
|
|
||||||
push: routerPushMock,
|
|
||||||
},
|
|
||||||
$loading: {
|
|
||||||
show: jest.fn(() => {
|
|
||||||
return { hide: jest.fn() }
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
$apollo: {
|
|
||||||
mutate: apolloMutationMock,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
stubs,
|
path: {
|
||||||
}
|
mock: 'checkEmail',
|
||||||
|
includes: jest.fn((t) => t === mocks.$route.path.mock),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
$toasted: {
|
||||||
|
global: {
|
||||||
|
error: toasterMock,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
$router: {
|
||||||
|
push: routerPushMock,
|
||||||
|
},
|
||||||
|
$loading: {
|
||||||
|
show: jest.fn(() => {
|
||||||
|
return { hide: jest.fn() }
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
$apollo: {
|
||||||
|
mutate: apolloMutationMock,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('ResetPassword', () => {
|
describe('ResetPassword', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
const Wrapper = (functionName) => {
|
const Wrapper = () => {
|
||||||
return mount(ResetPassword, functionName)
|
return mount(ResetPassword, { localVue, mocks, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
wrapper = Wrapper(createMockObject())
|
wrapper = Wrapper()
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('No valid optin', () => {
|
describe('No valid optin', () => {
|
||||||
@ -86,11 +80,32 @@ describe('ResetPassword', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('Register header', () => {
|
describe('Register header', () => {
|
||||||
it('has a welcome message', async () => {
|
describe('from reset', () => {
|
||||||
expect(wrapper.find('div.header').text()).toContain('settings.password.reset')
|
beforeEach(() => {
|
||||||
expect(wrapper.find('div.header').text()).toContain(
|
mocks.$route.path.mock = 'reset'
|
||||||
'settings.password.reset-password.text',
|
wrapper = Wrapper()
|
||||||
)
|
})
|
||||||
|
|
||||||
|
it('has a welcome message', async () => {
|
||||||
|
expect(wrapper.find('div.header').text()).toContain('settings.password.reset')
|
||||||
|
expect(wrapper.find('div.header').text()).toContain(
|
||||||
|
'settings.password.reset-password.text',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('from checkEmail', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
mocks.$route.path.mock = 'checkEmail'
|
||||||
|
wrapper = Wrapper()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('has a welcome message', async () => {
|
||||||
|
expect(wrapper.find('div.header').text()).toContain('settings.password.set')
|
||||||
|
expect(wrapper.find('div.header').text()).toContain(
|
||||||
|
'settings.password.set-password.text',
|
||||||
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -128,7 +143,6 @@ describe('ResetPassword', () => {
|
|||||||
|
|
||||||
describe('submit form', () => {
|
describe('submit form', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
// wrapper = Wrapper(createMockObject())
|
|
||||||
await wrapper.findAll('input').at(0).setValue('Aa123456_')
|
await wrapper.findAll('input').at(0).setValue('Aa123456_')
|
||||||
await wrapper.findAll('input').at(1).setValue('Aa123456_')
|
await wrapper.findAll('input').at(1).setValue('Aa123456_')
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
@ -164,14 +178,14 @@ describe('ResetPassword', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('server response with success', () => {
|
describe('server response with success on /checkEmail', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
mocks.$route.path.mock = 'checkEmail'
|
||||||
apolloMutationMock.mockResolvedValue({
|
apolloMutationMock.mockResolvedValue({
|
||||||
data: {
|
data: {
|
||||||
resetPassword: 'success',
|
resetPassword: 'success',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
wrapper = Wrapper(createMockObject('checkEmail'))
|
|
||||||
await wrapper.findAll('input').at(0).setValue('Aa123456_')
|
await wrapper.findAll('input').at(0).setValue('Aa123456_')
|
||||||
await wrapper.findAll('input').at(1).setValue('Aa123456_')
|
await wrapper.findAll('input').at(1).setValue('Aa123456_')
|
||||||
await wrapper.find('form').trigger('submit')
|
await wrapper.find('form').trigger('submit')
|
||||||
@ -189,6 +203,26 @@ describe('ResetPassword', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('redirects to "/thx/checkEmail"', () => {
|
||||||
|
expect(routerPushMock).toHaveBeenCalledWith('/thx/checkEmail')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('server response with success on /reset', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
mocks.$route.path.mock = 'reset'
|
||||||
|
wrapper = Wrapper()
|
||||||
|
apolloMutationMock.mockResolvedValue({
|
||||||
|
data: {
|
||||||
|
resetPassword: 'success',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await wrapper.findAll('input').at(0).setValue('Aa123456_')
|
||||||
|
await wrapper.findAll('input').at(1).setValue('Aa123456_')
|
||||||
|
await wrapper.find('form').trigger('submit')
|
||||||
|
await flushPromises()
|
||||||
|
})
|
||||||
|
|
||||||
it('redirects to "/thx/reset"', () => {
|
it('redirects to "/thx/reset"', () => {
|
||||||
expect(routerPushMock).toHaveBeenCalledWith('/thx/reset')
|
expect(routerPushMock).toHaveBeenCalledWith('/thx/reset')
|
||||||
})
|
})
|
||||||
|
|||||||
@ -92,7 +92,11 @@ export default {
|
|||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.form.password = ''
|
this.form.password = ''
|
||||||
this.$router.push('/thx/reset')
|
if (this.$route.path.includes('checkEmail')) {
|
||||||
|
this.$router.push('/thx/checkEmail')
|
||||||
|
} else {
|
||||||
|
this.$router.push('/thx/reset')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.$toasted.global.error(error.message)
|
this.$toasted.global.error(error.message)
|
||||||
|
|||||||
@ -34,6 +34,7 @@
|
|||||||
</b-row>
|
</b-row>
|
||||||
|
|
||||||
<b-container class="bv-example-row mt-3 gray-background p-2">
|
<b-container class="bv-example-row mt-3 gray-background p-2">
|
||||||
|
<p>{{ $t('advanced-calculation') }}</p>
|
||||||
<b-row class="pr-3">
|
<b-row class="pr-3">
|
||||||
<b-col class="text-right">{{ $t('form.current_balance') }}</b-col>
|
<b-col class="text-right">{{ $t('form.current_balance') }}</b-col>
|
||||||
<b-col class="text-right">{{ $n(balance, 'decimal') }}</b-col>
|
<b-col class="text-right">{{ $n(balance, 'decimal') }}</b-col>
|
||||||
@ -42,18 +43,13 @@
|
|||||||
<b-col class="text-right">
|
<b-col class="text-right">
|
||||||
<strong>{{ $t('form.your_amount') }}</strong>
|
<strong>{{ $t('form.your_amount') }}</strong>
|
||||||
</b-col>
|
</b-col>
|
||||||
<b-col class="text-right">
|
<b-col class="text-right borderbottom">
|
||||||
<strong>- {{ $n(amount, 'decimal') }}</strong>
|
<strong>- {{ $n(amount, 'decimal') }}</strong>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
<b-row class="pr-3">
|
|
||||||
<b-col class="text-right">{{ $t('decay.decay') }}</b-col>
|
|
||||||
<b-col class="text-right" style="border-bottom: double">- {{ $n(decay, 'decimal') }}</b-col>
|
|
||||||
</b-row>
|
|
||||||
|
|
||||||
<b-row class="pr-3">
|
<b-row class="pr-3">
|
||||||
<b-col class="text-right">{{ $t('form.new_balance') }}</b-col>
|
<b-col class="text-right">{{ $t('form.new_balance') }}</b-col>
|
||||||
<b-col class="text-right">~ {{ $n(balance - amount - decay, 'decimal') }}</b-col>
|
<b-col class="text-right">~ {{ $n(balance - amount, 'decimal') }}</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
</b-container>
|
</b-container>
|
||||||
|
|
||||||
@ -95,5 +91,6 @@ export default {
|
|||||||
}
|
}
|
||||||
.borderbottom {
|
.borderbottom {
|
||||||
border-bottom: 1px solid rgb(70, 65, 65);
|
border-bottom: 1px solid rgb(70, 65, 65);
|
||||||
|
border-bottom-style: double;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -138,10 +138,6 @@ describe('UserCard_Language', () => {
|
|||||||
expect(storeCommitMock).toBeCalledWith('language', 'en')
|
expect(storeCommitMock).toBeCalledWith('language', 'en')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('changes the i18n locale', () => {
|
|
||||||
expect(mocks.$i18n.locale).toBe('en')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('has no select field anymore', () => {
|
it('has no select field anymore', () => {
|
||||||
expect(wrapper.find('select').exists()).toBeFalsy()
|
expect(wrapper.find('select').exists()).toBeFalsy()
|
||||||
})
|
})
|
||||||
|
|||||||
@ -60,7 +60,6 @@
|
|||||||
</b-card>
|
</b-card>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { localeChanged } from 'vee-validate'
|
|
||||||
import LanguageSwitchSelect from '../../../components/LanguageSwitchSelect.vue'
|
import LanguageSwitchSelect from '../../../components/LanguageSwitchSelect.vue'
|
||||||
import { updateUserInfos } from '../../../graphql/mutations'
|
import { updateUserInfos } from '../../../graphql/mutations'
|
||||||
|
|
||||||
@ -97,8 +96,6 @@ export default {
|
|||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$store.commit('language', this.language)
|
this.$store.commit('language', this.language)
|
||||||
this.$i18n.locale = this.language
|
|
||||||
localeChanged(this.language)
|
|
||||||
this.cancelEdit()
|
this.cancelEdit()
|
||||||
this.$toasted.success(this.$t('settings.language.success'))
|
this.$toasted.success(this.$t('settings.language.success'))
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user