Merge branch 'community_15_04_2021' of github.com:gradido/gradido into community_15_04_2021

This commit is contained in:
Dario Rekowski on RockPI 2021-04-21 09:58:44 +00:00
commit 809e9133ab
25 changed files with 894 additions and 367 deletions

View File

@ -6,34 +6,13 @@ on:
- master - master
jobs: jobs:
##############################################################################
# JOB: PREPARE ###############################################################
##############################################################################
#prepare:
# name: Prepare
# runs-on: ubuntu-latest
# # needs: [nothing]
# steps:
# ##########################################################################
# # CHECKOUT CODE ##########################################################
# ##########################################################################
# - name: Checkout code
# uses: actions/checkout@v2
# ##########################################################################
# # TODO: DO STUFF ??? #####################################################
# ##########################################################################
# - name: Check translation files
# run: |
# scripts/translations/sort.sh
# scripts/translations/missing-keys.sh
############################################################################## ##############################################################################
# JOB: DOCKER BUILD COMMUNITY NEO4J ########################################## # JOB: DOCKER BUILD COMMUNITY NEO4J ##########################################
############################################################################## ##############################################################################
build_production_frontend: build_production_frontend:
name: Docker Build Production - Frontend name: Docker Build Production - Frontend
runs-on: ubuntu-latest runs-on: ubuntu-latest
#needs: [prepare] [nothing] #needs: [nothing]
steps: steps:
########################################################################## ##########################################################################
# CHECKOUT CODE ########################################################## # CHECKOUT CODE ##########################################################
@ -65,116 +44,154 @@ jobs:
path: /tmp/frontend.tar path: /tmp/frontend.tar
############################################################################## ##############################################################################
# JOB: DOCKER BUILD PRODUCTION BACKEND ####################################### # JOB: DOCKER BUILD PRODUCTION LOGIN SERVER ##################################
############################################################################## ##############################################################################
#build_production_backend: build_production_login_server:
# name: Docker Build Production - Backend name: Docker Build Production - Login Server
# runs-on: ubuntu-latest runs-on: ubuntu-latest
# needs: [prepare] #needs: [nothing]
# steps: steps:
# ########################################################################## ##########################################################################
# # CHECKOUT CODE ########################################################## # CHECKOUT CODE ##########################################################
# ########################################################################## ##########################################################################
# - name: Checkout code - name: Checkout code
# uses: actions/checkout@v2 uses: actions/checkout@v2
# ########################################################################## with:
# # SET ENVS ############################################################### submodules: recursive
# ########################################################################## ##########################################################################
# - name: ENV - VERSION # SET ENVS ###############################################################
# run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV ##########################################################################
# - name: ENV - BUILD_DATE - name: ENV - VERSION
# run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV
# - name: ENV - BUILD_VERSION - name: ENV - BUILD_DATE
# run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
# - name: ENV - BUILD_COMMIT - name: ENV - BUILD_VERSION
# run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
# ########################################################################## - name: ENV - BUILD_COMMIT
# # BUILD BACKEND DOCKER IMAGE (production) ################################ run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
# ########################################################################## ##########################################################################
# - name: backend | Build `production` image # LOGIN SERVER ###########################################################
# run: | ##########################################################################
# docker build --target production -t "ocelotsocialnetwork/backend:latest" -t "ocelotsocialnetwork/backend:${VERSION}" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" backend/ - name: Login Server | Build `production` image
# docker save "ocelotsocialnetwork/backend" > /tmp/backend.tar run: |
# - name: Upload Artifact docker build -t "gradido/login_server:latest" -t "gradido/login_server:production" -t "gradido/login_server:${VERSION}" -t "gradido/login_server:${BUILD_VERSION}" login_server/
# uses: actions/upload-artifact@v2 docker save "gradido/login_server" > /tmp/login_server.tar
# with: - name: Upload Artifact
# name: docker-backend-production uses: actions/upload-artifact@v2
# path: /tmp/backend.tar with:
name: docker-login-server-production
path: /tmp/login_server.tar
############################################################################## ##############################################################################
# JOB: DOCKER BUILD PRODUCTION WEBAPP ######################################## # JOB: DOCKER BUILD PRODUCTION COMMUNITY SERVER ##############################
############################################################################## ##############################################################################
#build_production_webapp: build_production_community_server:
# name: Docker Build Production - WebApp name: Docker Build Production - Community Server
# runs-on: ubuntu-latest runs-on: ubuntu-latest
# needs: [prepare] #needs: [nothing]
# steps: steps:
# ########################################################################## ##########################################################################
# # CHECKOUT CODE ########################################################## # CHECKOUT CODE ##########################################################
# ########################################################################## ##########################################################################
# - name: Checkout code - name: Checkout code
# uses: actions/checkout@v2 uses: actions/checkout@v2
# ########################################################################## ##########################################################################
# # SET ENVS ############################################################### # SET ENVS ###############################################################
# ########################################################################## ##########################################################################
# - name: ENV - VERSION - name: ENV - VERSION
# run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV
# - name: ENV - BUILD_DATE - name: ENV - BUILD_DATE
# run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
# - name: ENV - BUILD_VERSION - name: ENV - BUILD_VERSION
# run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
# - name: ENV - BUILD_COMMIT - name: ENV - BUILD_COMMIT
# run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
# ########################################################################## ##########################################################################
# # BUILD WEBAPP DOCKER IMAGE (build) ###################################### # COMMUNITY SERVER #######################################################
# ########################################################################## ##########################################################################
# - name: webapp | Build `production` image - name: Community Server | Build `production` image
# run: | run: |
# docker build --target production -t "ocelotsocialnetwork/webapp:latest" -t "ocelotsocialnetwork/webapp:${VERSION}" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" webapp/ docker build -t "gradido/community_server:latest" -t "gradido/community_server:production" -t "gradido/community_server:${VERSION}" -t "gradido/community_server:${BUILD_VERSION}" -f ./community_server/Dockerfile ./
# docker save "ocelotsocialnetwork/webapp" > /tmp/webapp.tar docker save "gradido/community_server" > /tmp/community_server.tar
# - name: Upload Artifact - name: Upload Artifact
# uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
# with: with:
# name: docker-webapp-production name: docker-community-server-production
# path: /tmp/webapp.tar path: /tmp/community_server.tar
############################################################################## ##############################################################################
# JOB: DOCKER BUILD PRODUCTION MAINTENANCE ################################### # JOB: DOCKER BUILD PRODUCTION MARIADB #######################################
############################################################################## ##############################################################################
#build_production_maintenance: build_production_mariadb:
# name: Docker Build Production - Maintenance name: Docker Build Production - MariaDB
# runs-on: ubuntu-latest runs-on: ubuntu-latest
# needs: [prepare] #needs: [nothing]
# steps: steps:
# ########################################################################## ##########################################################################
# # CHECKOUT CODE ########################################################## # CHECKOUT CODE ##########################################################
# ########################################################################## ##########################################################################
# - name: Checkout code - name: Checkout code
# uses: actions/checkout@v2 uses: actions/checkout@v2
# ########################################################################## ##########################################################################
# # SET ENVS ############################################################### # SET ENVS ###############################################################
# ########################################################################## ##########################################################################
# - name: ENV - VERSION - name: ENV - VERSION
# run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV
# - name: ENV - BUILD_DATE - name: ENV - BUILD_DATE
# run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
# - name: ENV - BUILD_VERSION - name: ENV - BUILD_VERSION
# run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
# - name: ENV - BUILD_COMMIT - name: ENV - BUILD_COMMIT
# run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
# ########################################################################## ##########################################################################
# # BUILD MAINTENANCE DOCKER IMAGE (build) ################################# # MARIADB ################################################################
# ########################################################################## ##########################################################################
# - name: maintenance | Build `production` image - name: MariaDB | Build `production` image
# # TODO: --target production run: |
# run: | docker build -t "gradido/mariadb:latest" -t "gradido/mariadb:production" -t "gradido/mariadb:${VERSION}" -t "gradido/mariadb:${BUILD_VERSION}" -f ./mariadb/Dockerfile ./
# docker build -t "ocelotsocialnetwork/maintenance:latest" -t "ocelotsocialnetwork/maintenance:${VERSION}" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" webapp/ -f webapp/Dockerfile.maintenance docker save "gradido/mariadb" > /tmp/mariadb.tar
# docker save "ocelotsocialnetwork/maintenance" > /tmp/maintenance.tar - name: Upload Artifact
# - name: Upload Artifact uses: actions/upload-artifact@v2
# uses: actions/upload-artifact@v2 with:
# with: name: docker-mariadb-production
# name: docker-maintenance-production path: /tmp/mariadb.tar
# path: /tmp/maintenance.tar
##############################################################################
# JOB: DOCKER BUILD PRODUCTION NGINX #########################################
##############################################################################
build_production_nginx:
name: Docker Build Production - Nginx
runs-on: ubuntu-latest
#needs: [nothing]
steps:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
- name: Checkout code
uses: actions/checkout@v2
##########################################################################
# SET ENVS ###############################################################
##########################################################################
- name: ENV - VERSION
run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV
- name: ENV - BUILD_DATE
run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
- name: ENV - BUILD_VERSION
run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
- name: ENV - BUILD_COMMIT
run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
##########################################################################
# NGINX ##################################################################
##########################################################################
- name: Nginx | Build `production` image
run: |
docker build -t "gradido/nginx:latest" -t "gradido/nginx:production" -t "gradido/nginx:${VERSION}" -t "gradido/nginx:${BUILD_VERSION}" -f ./nginx/Dockerfile ./
docker save "gradido/nginx" > /tmp/nginx.tar
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: docker-nginx-production
path: /tmp/nginx.tar
############################################################################## ##############################################################################
# JOB: UPLOAD TO DOCKERHUB ################################################### # JOB: UPLOAD TO DOCKERHUB ###################################################
@ -182,7 +199,7 @@ jobs:
upload_to_dockerhub: upload_to_dockerhub:
name: Upload to Dockerhub name: Upload to Dockerhub
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [build_production_frontend] needs: [build_production_frontend, build_production_login_server, build_production_community_server, build_production_mariadb, build_production_nginx]
env: env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
@ -202,27 +219,34 @@ jobs:
path: /tmp path: /tmp
- name: Load Docker Image - name: Load Docker Image
run: docker load < /tmp/frontend.tar run: docker load < /tmp/frontend.tar
#- name: Download Docker Image (Backend) - name: Download Docker Image (Login Server)
# uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
# with: with:
# name: docker-backend-production name: docker-login-server-production
# path: /tmp path: /tmp
#- name: Load Docker Image - name: Load Docker Image
# run: docker load < /tmp/backend.tar run: docker load < /tmp/login_server.tar
#- name: Download Docker Image (WebApp) - name: Download Docker Image (Community Server)
# uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
# with: with:
# name: docker-webapp-production name: docker-community-server-production
# path: /tmp path: /tmp
#- name: Load Docker Image - name: Load Docker Image
# run: docker load < /tmp/webapp.tar run: docker load < /tmp/community_server.tar
#- name: Download Docker Image (Maintenance) - name: Download Docker Image (MariaDB)
# uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
# with: with:
# name: docker-maintenance-production name: docker-mariadb-production
# path: /tmp path: /tmp
#- name: Load Docker Image - name: Load Docker Image
# run: docker load < /tmp/maintenance.tar run: docker load < /tmp/mariadb.tar
- name: Download Docker Image (Nginx)
uses: actions/download-artifact@v2
with:
name: docker-nginx-production
path: /tmp
- name: Load Docker Image
run: docker load < /tmp/nginx.tar
########################################################################## ##########################################################################
# Upload ################################################################# # Upload #################################################################
########################################################################## ##########################################################################
@ -230,16 +254,18 @@ jobs:
run: echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin run: echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin
- name: Push frontend - name: Push frontend
run: docker push --all-tags gradido/frontend run: docker push --all-tags gradido/frontend
#- name: Push backend - name: Push login_server
# run: docker push --all-tags ocelotsocialnetwork/backend run: docker push --all-tags gradido/login_server
#- name: Push webapp - name: Push community_server
# run: docker push --all-tags ocelotsocialnetwork/webapp run: docker push --all-tags gradido/community_server
#- name: Push maintenance - name: Push MariaDB
# run: docker push --all-tags ocelotsocialnetwork/maintenance run: docker push --all-tags gradido/mariadb
- name: Push Nginx
run: docker push --all-tags gradido/nginx
##############################################################################
# JOB: GITHUB TAG LATEST VERSION ############################################# # JOB: GITHUB TAG LATEST VERSION #############################################
############################################################################## ##############################################################################
##############################################################################
github_tag: github_tag:
name: Tag latest version on Github name: Tag latest version on Github
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -46,17 +46,17 @@ jobs:
with: with:
submodules: recursive submodules: recursive
########################################################################## ##########################################################################
# BUILD LOGIN SERVER DOCKER IMAGE (build) ################################ # BUILD LOGIN SERVER DOCKER IMAGE ########################################
########################################################################## ##########################################################################
- name: login server | Build `test` image - name: login server | Build `test` image
run: | run: |
docker build --target login_server_debug -t "gradido/loginserver:test" -f ./login_server/Dockerfile.debug login_server/ docker build --target login_server_debug -t "gradido/login_server:test" -f ./login_server/Dockerfile.debug login_server/
docker save "gradido/loginserver:test" > /tmp/loginserver.tar docker save "gradido/login_server:test" > /tmp/login_server.tar
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: docker-loginserver-test name: docker-login-server-test
path: /tmp/loginserver.tar path: /tmp/login_server.tar
############################################################################## ##############################################################################
# JOB: DOCKER BUILD TEST COMMUNITY SERVER #################################### # JOB: DOCKER BUILD TEST COMMUNITY SERVER ####################################
@ -72,23 +72,75 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
########################################################################## ##########################################################################
# BUILD COMMUNITY SERVER DOCKER IMAGE (build) ############################ # BUILD COMMUNITY SERVER DOCKER IMAGE ####################################
########################################################################## ##########################################################################
- name: community server | Build `test` image - name: community server | Build `test` image
run: | run: |
docker build -t "gradido/communityserver:test" -f ./community_server/Dockerfile ./ docker build -t "gradido/community_server:test" -f ./community_server/Dockerfile ./
docker save "gradido/communityserver:test" > /tmp/communityserver.tar docker save "gradido/community_server:test" > /tmp/community_server.tar
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: docker-communityserver-test name: docker-community-server-test
path: /tmp/communityserver.tar path: /tmp/community_server.tar
##############################################################################
# JOB: DOCKER BUILD TEST MARIADB #############################################
##############################################################################
build_test_mariadb:
name: Docker Build Test - MariaDB
runs-on: ubuntu-latest
#needs: [nothing]
steps:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
- name: Checkout code
uses: actions/checkout@v2
##########################################################################
# BUILD MARIADB DOCKER IMAGE #############################################
##########################################################################
- name: mariadb | Build `test` image
run: |
docker build -t "gradido/mariadb:test" -f ./mariadb/Dockerfile ./
docker save "gradido/mariadb:test" > /tmp/mariadb.tar
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: docker-mariadb-test
path: /tmp/mariadb.tar
##############################################################################
# JOB: DOCKER BUILD TEST NGINX ###############################################
##############################################################################
build_test_nginx:
name: Docker Build Test - Nginx
runs-on: ubuntu-latest
#needs: [nothing]
steps:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
- name: Checkout code
uses: actions/checkout@v2
##########################################################################
# BUILD NGINX DOCKER IMAGE #############################################
##########################################################################
- name: nginx | Build `test` image
run: |
docker build -t "gradido/nginx:test" -f ./nginx/Dockerfile ./
docker save "gradido/nginx:test" > /tmp/nginx.tar
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: docker-nginx-test
path: /tmp/nginx.tar
############################################################################## ##############################################################################
# JOB: LINT FRONTEND ######################################################### # JOB: LINT FRONTEND #########################################################
############################################################################## ##############################################################################
lint_frontend: lint_frontend:
name: Lint frontend name: Lint - Frontend
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [build_test_frontend] needs: [build_test_frontend]
steps: steps:
@ -155,11 +207,12 @@ jobs:
# COVERAGE CHECK FRONTEND ################################################ # COVERAGE CHECK FRONTEND ################################################
########################################################################## ##########################################################################
- name: frontend | Coverage check - name: frontend | Coverage check
uses: devmasx/coverage-check-action@v1.2.0 uses: webcraftmedia/coverage-check-action@master
with: with:
report_name: Coverage Frontend
type: lcov type: lcov
result_path: ./coverage/lcov.info result_path: ./coverage/lcov.info
min_coverage: 10 min_coverage: 11
token: ${{ github.token }} token: ${{ github.token }}
#test: #test:

View File

@ -37,9 +37,9 @@ services:
######################################################### #########################################################
## COMMUNITY SERVER (cakephp with php-fpm) ############## ## COMMUNITY SERVER (cakephp with php-fpm) ##############
######################################################### #########################################################
community-server: #community-server:
volumes: # volumes:
- ./community_server # - ./community_server
######################################################### #########################################################

View File

@ -17,7 +17,7 @@
</header> </header>
<div class=""> <div class="">
<particles-bg type="custom" :config="config" :bg="true" /> <particles-bg type="custom" :config="config" :bg="true" />
<router-view /> <component :is="$store.state.session_id ? 'DashboardLayout' : 'AuthLayoutGDD'" />
</div> </div>
</div> </div>
</template> </template>
@ -26,11 +26,15 @@
import { ParticlesBg } from 'particles-bg-vue' import { ParticlesBg } from 'particles-bg-vue'
import icon from './icon.js' import icon from './icon.js'
import { localeChanged } from 'vee-validate' import { localeChanged } from 'vee-validate'
import DashboardLayout from '@/views/Layout/DashboardLayout_gdd.vue'
import AuthLayoutGDD from '@/views/Layout/AuthLayout_gdd.vue'
export default { export default {
name: 'app', name: 'app',
components: { components: {
ParticlesBg, ParticlesBg,
DashboardLayout,
AuthLayoutGDD,
}, },
data() { data() {
return { return {
@ -56,7 +60,10 @@ export default {
this.$router.push('overview') this.$router.push('overview')
} else { } else {
//console.log('app.vue to Logout') //console.log('app.vue to Logout')
this.$store.dispatch('logout') if (this.$route.path == '/reset') {
} else {
this.$store.dispatch('logout')
}
} }
}, },
data() { data() {

View File

@ -36,7 +36,9 @@ const communityAPI = {
return apiGet(CONFIG.COMMUNITY_API_STATE_BALANCE_URL + 'getBalance/' + session_id) return apiGet(CONFIG.COMMUNITY_API_STATE_BALANCE_URL + 'getBalance/' + session_id)
}, },
transactions: async (session_id) => { transactions: async (session_id) => {
return apiGet(CONFIG.COMMUNITY_API_STATE_BALANCE_URL + 'listTransactions/1/25/ASC/' + session_id) return apiGet(
CONFIG.COMMUNITY_API_STATE_BALANCE_URL + 'listTransactions/1/25/ASC/' + session_id,
)
}, },
/*create: async (session_id, email, amount, memo, target_date = new Date() ) => { /*create: async (session_id, email, amount, memo, target_date = new Date() ) => {
const payload = { const payload = {

View File

@ -63,6 +63,15 @@ const loginAPI = {
} }
return apiPost(CONFIG.LOGIN_API_URL + 'createUser', payload) return apiPost(CONFIG.LOGIN_API_URL + 'createUser', payload)
}, },
sendEmail: async (email, email_text = 7, email_verification_code_type = 'resetPassword') => {
//console.log('api email', email)
const payload = {
email,
email_text,
email_verification_code_type,
}
return apiPost(CONFIG.LOGIN_API_URL + 'sendEmail', payload)
},
} }
export default loginAPI export default loginAPI

View File

@ -8,6 +8,7 @@
"imprint":"Impressum", "imprint":"Impressum",
"privacy_policy":"Datenschutzerklärung", "privacy_policy":"Datenschutzerklärung",
"members_area": "Mitgliedsbereich", "members_area": "Mitgliedsbereich",
"whitepaper": "Whitepaper",
"back":"Zurück", "back":"Zurück",
"send":"Senden", "send":"Senden",
"transactions":"Transaktionen", "transactions":"Transaktionen",
@ -24,7 +25,7 @@
"sender":"Absender", "sender":"Absender",
"firstname":"Vorname", "firstname":"Vorname",
"lastname":"Nachname", "lastname":"Nachname",
"email":"eMail", "email":"E-Mail",
"email_repeat":"eMail wiederholen", "email_repeat":"eMail wiederholen",
"password":"Passwort", "password":"Passwort",
"password_repeat":"Passwort wiederholen", "password_repeat":"Passwort wiederholen",
@ -59,9 +60,12 @@
"signup": { "signup": {
"title": "Erstelle dein Gradido-Konto", "title": "Erstelle dein Gradido-Konto",
"subtitle": "Werde Teil der Gemeinschaft!", "subtitle": "Werde Teil der Gemeinschaft!",
"strength":"Passwortsicherheit:", "agree":"Ich stimme der <a href='https://gradido.net/de/datenschutz/' target='_blank' >Datenschutzerklärung</a> zu.",
"strong":"stark", "lowercase":"Ein Kleinbuchstabe erforderlich.",
"agree":"habe ich gelesen und verstanden und stimme diesen zu." "uppercase":"Ein Großbuchstabe erforderlich.",
"minimum":"Mindestens 8 Zeichen.",
"one_number":"Eine Zahl erforderlich.",
"dont_match":"Die Passwörter stimmen nicht überein."
}, },
"password": { "password": {
"title": "Passwort zurücksetzen", "title": "Passwort zurücksetzen",

View File

@ -8,6 +8,7 @@
"imprint":"Legal notice", "imprint":"Legal notice",
"privacy_policy":"Privacy policy", "privacy_policy":"Privacy policy",
"members_area": "Member's area", "members_area": "Member's area",
"whitepaper": "Whitepaper",
"back":"Back", "back":"Back",
"send":"Send", "send":"Send",
"transactions":"Transactions", "transactions":"Transactions",
@ -59,9 +60,12 @@
"signup": { "signup": {
"title": "Create your Gradido account", "title": "Create your Gradido account",
"subtitle": "Become a part of the community!", "subtitle": "Become a part of the community!",
"strength":"Password strength:", "agree":"I agree to the <a href='https://gradido.net/en/datenschutz/' target='_blank' > privacy policy</a>.",
"strong":"strong", "lowercase":"One lowercase letter required.",
"agree":"I have read and understood and agree to them" "uppercase":"One uppercase letter required.",
"minimum":"8 characters minimum.",
"one_number":"One number required.",
"dont_match":"Passwords don't match."
}, },
"password": { "password": {
"title": "Reset password", "title": "Reset password",

View File

@ -21,10 +21,6 @@ const router = new VueRouter({
}) })
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
let language = to.params.lang
if (!language) {
language = 'de'
}
next() next()
}) })

View File

@ -1,66 +1,48 @@
import DashboardLayout from '@/views/Layout/DashboardLayout_gdd.vue'
import AuthLayoutGDD from '@/views/Layout/AuthLayout_gdd.vue'
import NotFound from '@/views/NotFoundPage.vue' import NotFound from '@/views/NotFoundPage.vue'
const routes = [ const routes = [
{ {
path: '/login', path: '/overview',
redirect: 'login', component: () => import('../views/Pages/KontoOverview.vue'),
component: AuthLayoutGDD, meta: {
children: [ requiresAuth: true,
{ },
path: '/login',
component: () => import('../views/Pages/Login.vue'),
},
{
path: '/thx',
component: () => import('../views/Pages/thx.vue'),
},
{
path: '/register',
component: () => import('../views/Pages/Register.vue'),
},
{
path: '/password',
component: () => import('../views/Pages/Password.vue'),
},
{
path: '/explorer',
name: 'Explorer',
component: () => import('../views/Pages/Explorer.vue'),
},
],
}, },
{ {
path: '/overview', path: '/profile',
redirect: 'overview', component: () => import('../views/Pages/UserProfileCard.vue'),
component: DashboardLayout, },
children: [ {
{ path: '/profileedit',
path: '/overview', component: () => import('../views/Pages/UserProfileEdit.vue'),
component: () => import('../views/KontoOverview.vue'), },
meta: { {
requiresAuth: true, path: '/activity',
}, component: () => import('../views/Pages/UserProfileActivity.vue'),
}, },
{ {
path: '/profile', path: '/transactions',
component: () => import('../views/Pages/UserProfileCard.vue'), component: () => import('../views/Pages/UserProfileTransactionList.vue'),
}, },
{ {
path: '/profileedit', path: '/login',
component: () => import('../views/Pages/UserProfileEdit.vue'), component: () => import('../views/Pages/Login.vue'),
}, },
{ {
path: '/activity', path: '/thx',
component: () => import('../views/Pages/UserProfileActivity.vue'), component: () => import('../views/Pages/thx.vue'),
}, },
{ {
path: '/transactions', path: '/register',
component: () => import('../views/Pages/UserProfileTransactionList.vue'), component: () => import('../views/Pages/Register.vue'),
}, },
], {
path: '/password',
component: () => import('../views/Pages/ForgotPassword.vue'),
},
{
path: '/reset',
component: () => import('../views/Pages/ResetPassword.vue'),
}, },
{ path: '*', component: NotFound }, { path: '*', component: NotFound },
] ]

View File

@ -63,7 +63,6 @@ export const store = new Vuex.Store({
state.user.balance_gdt = balance / 10000 state.user.balance_gdt = balance / 10000
}, },
}, },
// Asyncronous actions - used for api calls
actions: { actions: {
login: async ({ dispatch, commit }, data) => { login: async ({ dispatch, commit }, data) => {
const result = await loginAPI.login(data.email, data.password) const result = await loginAPI.login(data.email, data.password)
@ -74,19 +73,11 @@ export const store = new Vuex.Store({
$cookies.set('gdd_u', data.email) $cookies.set('gdd_u', data.email)
router.push('/overview') router.push('/overview')
} else { } else {
// Register failed, we perform a logout
//alert('>>>>> FAIl LOGIN')
commit('loginfail', true) commit('loginfail', true)
//dispatch('logout') //dispatch('logout')
} }
}, },
passwordReset: async (data) => {
//console.log('<<<<<<<<<<< PASSWORT RESET TODO >>>>>>>>>>>', data.email)
},
schoepfen: async (data) => {
// http://localhost/transaction-creations/ajaxCreate
},
createUser: async ({ commit, dispatch }, data) => { createUser: async ({ commit, dispatch }, data) => {
// console.log('action: createUser') // console.log('action: createUser')
const result = await loginAPI.create( const result = await loginAPI.create(

View File

@ -1,17 +0,0 @@
<template>
<div class="content">
<fade-transition :duration="200" mode="out-in">
<!-- your content here -->
<router-view></router-view>
</fade-transition>
</div>
</template>
<script>
import { FadeTransition } from 'vue2-transitions'
export default {
components: {
FadeTransition,
},
}
</script>
<style></style>

View File

@ -41,63 +41,97 @@ describe('ContentFooter', () => {
}) })
it('links to the login page when clicked on copyright', () => { it('links to the login page when clicked on copyright', () => {
expect(wrapper.find('div.copyright').find('a').attributes('href')).toEqual('#/Login') expect(wrapper.find('div.copyright').find('a').attributes('href')).toEqual(
'https://gradido.net/en',
)
})
})
describe('version', () => {
it('shows the current version', async () => {
wrapper.setData({ version: 1.23 })
await wrapper.vm.$nextTick()
expect(wrapper.find('div.copyright').findAll('a').at(1).text()).toEqual('App version 1.23')
})
it('links to latest release on GitHub', () => {
expect(wrapper.find('div.copyright').findAll('a').at(1).attributes('href')).toEqual(
'https://github.com/gradido/gradido/releases/latest',
)
}) })
}) })
describe('links to gradido.net', () => { describe('links to gradido.net', () => {
it('has a link to the gradido.net', () => {
expect(wrapper.findAll('a.nav-link').at(0).text()).toEqual('Gradido')
})
it('links to the https://gradido.net/en when locale is en', () => {
expect(wrapper.findAll('a.nav-link').at(0).attributes('href')).toEqual(
'https://gradido.net/en',
)
})
it('has a link to the legal notice', () => { it('has a link to the legal notice', () => {
expect(wrapper.findAll('a.nav-link').at(1).text()).toEqual('imprint') expect(wrapper.findAll('a.nav-link').at(0).text()).toEqual('imprint')
}) })
it('links to the https://gradido.net/en/impressum when locale is en', () => { it('links to the https://gradido.net/en/impressum when locale is en', () => {
expect(wrapper.findAll('a.nav-link').at(1).attributes('href')).toEqual( expect(wrapper.findAll('a.nav-link').at(0).attributes('href')).toEqual(
'https://gradido.net/en/impressum/', 'https://gradido.net/en/impressum/',
) )
}) })
it('has a link to the privacy policy', () => { it('has a link to the privacy policy', () => {
expect(wrapper.findAll('a.nav-link').at(2).text()).toEqual('privacy_policy') expect(wrapper.findAll('a.nav-link').at(1).text()).toEqual('privacy_policy')
}) })
it('links to the https://gradido.net/en/datenschutz when locale is en', () => { it('links to the https://gradido.net/en/datenschutz when locale is en', () => {
expect(wrapper.findAll('a.nav-link').at(2).attributes('href')).toEqual( expect(wrapper.findAll('a.nav-link').at(1).attributes('href')).toEqual(
'https://gradido.net/en/datenschutz/', 'https://gradido.net/en/datenschutz/',
) )
}) })
it('has a link to the members area', () => {
expect(wrapper.findAll('a.nav-link').at(2).text()).toEqual('members_area')
})
it('links to the elopage', () => {
expect(wrapper.findAll('a.nav-link').at(2).attributes('href')).toEqual(
'https://elopage.com/s/gradido/sign_in?locale=en',
)
})
it('links to the whitepaper', () => {
expect(wrapper.findAll('a.nav-link').at(3).attributes('href')).toEqual(
'https://docs.google.com/document/d/1kcX1guOi6tDgnFHD9tf7fB_MneKTx-0nHJxzdN8ygNs/edit?usp=sharing',
)
})
describe('links are localized', () => { describe('links are localized', () => {
beforeEach(() => { beforeEach(() => {
mocks.$i18n.locale = 'de' mocks.$i18n.locale = 'de'
}) })
it('links to the https://gradido.net/de when locale is de', () => { it('links to the https://gradido.net/de when locale is de', () => {
expect(wrapper.findAll('a.nav-link').at(0).attributes('href')).toEqual( expect(wrapper.find('div.copyright').find('a').attributes('href')).toEqual(
'https://gradido.net/de', 'https://gradido.net/de',
) )
}) })
it('links to the https://gradido.net/de/impressum when locale is de', () => { it('links to the https://gradido.net/de/impressum when locale is de', () => {
expect(wrapper.findAll('a.nav-link').at(1).attributes('href')).toEqual( expect(wrapper.findAll('a.nav-link').at(0).attributes('href')).toEqual(
'https://gradido.net/de/impressum/', 'https://gradido.net/de/impressum/',
) )
}) })
it('links to the https://gradido.net/de/datenschutz when locale is de', () => { it('links to the https://gradido.net/de/datenschutz when locale is de', () => {
expect(wrapper.findAll('a.nav-link').at(2).attributes('href')).toEqual( expect(wrapper.findAll('a.nav-link').at(1).attributes('href')).toEqual(
'https://gradido.net/de/datenschutz/', 'https://gradido.net/de/datenschutz/',
) )
}) })
it('links to the German elopage when locale is de', () => {
expect(wrapper.findAll('a.nav-link').at(2).attributes('href')).toEqual(
'https://elopage.com/s/gradido/sign_in?locale=de',
)
})
it('links to the German whitepaper when locale is de', () => {
expect(wrapper.findAll('a.nav-link').at(3).attributes('href')).toEqual(
'https://docs.google.com/document/d/1jZp-DiiMPI9ZPNXmjsvOQ1BtnfDFfx8BX7CDmA8KKjY/edit?usp=sharing',
)
})
}) })
}) })
}) })

View File

@ -4,10 +4,12 @@
<b-col> <b-col>
<div class="copyright text-center text-lg-center text-muted"> <div class="copyright text-center text-lg-center text-muted">
© {{ year }} © {{ year }}
<a href="#/Login" class="font-weight-bold ml-1">Gradido-Akademie</a> <a :href="`https://gradido.net/${$i18n.locale}`" class="font-weight-bold ml-1">
Gradido-Akademie
</a>
| |
<a href="https://github.com/gradido/gradido/releases/latest" target="_blank"> <a href="https://github.com/gradido/gradido/releases/latest" target="_blank">
App Verion {{ version }} App version {{ version }}
</a> </a>
</div> </div>
</b-col> </b-col>
@ -15,9 +17,6 @@
<b-row align-v="center" class="justify-content-lg-between"> <b-row align-v="center" class="justify-content-lg-between">
<b-col> <b-col>
<b-nav class="nav-footer justify-content-center"> <b-nav class="nav-footer justify-content-center">
<b-nav-item :href="`https://gradido.net/${$i18n.locale}`" target="_blank">
Gradido
</b-nav-item>
<b-nav-item :href="`https://gradido.net/${$i18n.locale}/impressum/`" target="_blank"> <b-nav-item :href="`https://gradido.net/${$i18n.locale}/impressum/`" target="_blank">
{{ $t('imprint') }} {{ $t('imprint') }}
</b-nav-item> </b-nav-item>
@ -30,6 +29,16 @@
> >
{{ $t('members_area') }} {{ $t('members_area') }}
</b-nav-item> </b-nav-item>
<b-nav-item
:href="
$i18n.locale === 'de'
? 'https://docs.google.com/document/d/1jZp-DiiMPI9ZPNXmjsvOQ1BtnfDFfx8BX7CDmA8KKjY/edit?usp=sharing'
: 'https://docs.google.com/document/d/1kcX1guOi6tDgnFHD9tf7fB_MneKTx-0nHJxzdN8ygNs/edit?usp=sharing'
"
target="_blank"
>
{{ $t('whitepaper') }}
</b-nav-item>
</b-nav> </b-nav>
</b-col> </b-col>
</b-row> </b-row>

View File

@ -26,17 +26,10 @@
:placeholder="$t('form.email')" :placeholder="$t('form.email')"
name="Email" name="Email"
:rules="{ required: true, email: true }" :rules="{ required: true, email: true }"
v-model="model.email" v-model="form.email"
></base-input> ></base-input>
{{ form }}
<div class="text-center"> <div class="text-center">
<b-button <b-button type="submit" outline variant="secondary" class="mt-4">
type="submit"
outline
variant="secondary"
class="mt-4"
:disabled="disable"
>
{{ $t('site.password.reset_now') }} {{ $t('site.password.reset_now') }}
</b-button> </b-button>
</div> </div>
@ -53,21 +46,26 @@
</div> </div>
</template> </template>
<script> <script>
import loginAPI from '../../apis/loginAPI.js'
export default { export default {
name: 'password', name: 'password',
data() { data() {
return { return {
disable: 'disabled', disable: 'disabled',
model: { form: {
email: '', email: '',
}, },
} }
}, },
methods: { methods: {
onSubmit() { async onSubmit() {
this.$store.dispatch('passwordReset', { email: this.model.email }) const result = await loginAPI.sendEmail(this.form.email)
this.model.email = '' if (result.success) {
this.$router.push('/thx') this.$router.push({ path: '/thx', params: { id: 'resetmail' } })
} else {
alert(result.result)
}
}, },
}, },
} }

View File

@ -20,9 +20,9 @@
</div> </div>
</template> </template>
<script> <script>
import GddStatus from './KontoOverview/GddStatus.vue' import GddStatus from '../KontoOverview/GddStatus.vue'
import GddSend from './KontoOverview/GddSend.vue' import GddSend from '../KontoOverview/GddSend.vue'
import GddTable from './KontoOverview/GddTable.vue' import GddTable from '../KontoOverview/GddTable.vue'
export default { export default {
name: 'Overview', name: 'Overview',

View File

@ -89,6 +89,9 @@
</router-link> </router-link>
</b-col> </b-col>
</b-row> </b-row>
<b-row>
<b-col><router-link to="/reset">reset</router-link></b-col>
</b-row>
</b-col> </b-col>
</b-row> </b-row>
</b-container> </b-container>

View File

@ -0,0 +1,107 @@
import { mount, RouterLinkStub } from '@vue/test-utils'
import Vuex from 'vuex'
import flushPromises from 'flush-promises'
import Register from './Register'
const localVue = global.localVue
describe('Register', () => {
let wrapper
let mocks = {
$i18n: {
locale: 'en',
},
$t: jest.fn((t) => t),
}
let state = {
// loginfail: false,
}
let store = new Vuex.Store({
state,
})
let stubs = {
RouterLink: RouterLinkStub,
}
const Wrapper = () => {
return mount(Register, { localVue, mocks, store, stubs })
}
describe('mount', () => {
beforeEach(() => {
wrapper = Wrapper()
})
it('renders the Register form', () => {
expect(wrapper.find('div.register-form').exists()).toBeTruthy()
})
describe('Register header', () => {
it('has a welcome message', () => {
expect(wrapper.find('div.header').text()).toBe('site.signup.title site.signup.subtitle')
})
})
describe('links', () => {
it('has a link "Back"', () => {
expect(wrapper.findAllComponents(RouterLinkStub).at(0).text()).toEqual('back')
})
it('links to /login when clicking "Back"', () => {
expect(wrapper.findAllComponents(RouterLinkStub).at(0).props().to).toBe('/login')
})
})
describe('Register form', () => {
it('has a register form', () => {
expect(wrapper.find('form').exists()).toBeTruthy()
})
it('has 3 text input fields', () => {
expect(wrapper.findAll('input[type="text"]').length).toBe(3)
})
it('has 2 password input fields', () => {
expect(wrapper.findAll('input[type="password"]').length).toBe(2)
})
it('has 1 checkbox input fields', () => {
expect(wrapper.findAll('input[type="checkbox"]').length).toBe(1)
})
it('has no submit button when not completely filled', () => {
expect(wrapper.find('button[type="submit"]').exists()).toBe(false)
})
it('shows a warning when no valid Email is entered', async () => {
wrapper.findAll('input[type="text"]').at(2).setValue('no_valid@Email')
await flushPromises()
await expect(wrapper.find('.invalid-feedback').text()).toEqual(
'The Email field must be a valid email',
)
})
it('shows 4 warnings when no password is set', async () => {
const passwords = wrapper.findAll('input[type="password"]')
passwords.at(0).setValue('')
passwords.at(1).setValue('')
await flushPromises()
await expect(wrapper.find('div.hints').text()).toContain(
'site.signup.lowercase',
'site.signup.uppercase',
'site.signup.minimum',
'site.signup.one_number',
)
})
// TODO test different invalid password combinations
})
// TODO test submit button
})
})

View File

@ -1,5 +1,5 @@
<template> <template>
<div> <div class="register-form">
<!-- Header --> <!-- Header -->
<div class="header p-4"> <div class="header p-4">
<b-container class="container"> <b-container class="container">
@ -26,52 +26,81 @@
<validation-observer v-slot="{ handleSubmit }" ref="formValidator"> <validation-observer v-slot="{ handleSubmit }" ref="formValidator">
<b-form role="form" @submit.prevent="handleSubmit(onSubmit)"> <b-form role="form" @submit.prevent="handleSubmit(onSubmit)">
<base-input <base-input
:label="$t('form.firstname')"
alternative alternative
class="mb-3" class="mb-3"
prepend-icon="ni ni-hat-3" name="firstname"
:placeholder="$t('form.firstname')" :rules="{ required: true, min: 3 }"
name="Vorname"
:rules="{ required: true }"
v-model="model.firstname" v-model="model.firstname"
></base-input> ></base-input>
<base-input <base-input
:label="$t('form.lastname')"
alternative alternative
class="mb-3" class="mb-3"
prepend-icon="ni ni-hat-3" name="lastname"
:placeholder="$t('form.lastname')" :rules="{ required: true, min: 2 }"
name="Nachname"
:rules="{ required: true }"
v-model="model.lastname" v-model="model.lastname"
></base-input> ></base-input>
<base-input <base-input
:label="$t('form.email')"
alternative alternative
class="mb-3" class="mb-3"
prepend-icon="ni ni-email-83"
:placeholder="$t('form.email')"
name="Email" name="Email"
:rules="{ required: true, email: true }" :rules="{ required: true, email: true }"
v-model="model.email" v-model="model.email"
></base-input> ></base-input>
<hr />
<b-form-group :label="$t('form.password')">
<b-input-group>
<b-form-input
class="mb-0"
v-model="password"
name="password"
:class="{ valid: passwordValidation.valid }"
:type="passwordVisible ? 'text' : 'password'"
prepend-icon="ni ni-lock-circle-open"
:placeholder="$t('form.password')"
></b-form-input>
<b-input-group-append>
<b-button variant="outline-primary">
<b-icon
:icon="passwordVisible ? 'eye' : 'eye-slash'"
@click="togglePasswordVisibility"
/>
</b-button>
</b-input-group-append>
</b-input-group>
</b-form-group>
<base-input <base-input
alternative :label="$t('form.password_repeat')"
class="mb-3"
prepend-icon="ni ni-lock-circle-open"
:placeholder="$t('form.password')"
type="password" type="password"
name="Password" name="password-repeat"
:rules="{ required: true, min: 6 }" :placeholder="$t('form.password_repeat')"
v-model="model.password" prepend-icon="ni ni-lock-circle-open"
></base-input> v-model.lazy="checkPassword"
<div class="text-muted font-italic"> :class="{ valid: passwordValidation.valid }"
<small> />
{{ $t('site.signup.strength') }}
<span class="text-success font-weight-700"> <transition name="hint" appear>
{{ $t('site.signup.strong') }} <div v-if="passwordValidation.errors.length > 0 && !submitted" class="hints">
</span> <ul>
</small> <li v-for="error in passwordValidation.errors" :key="error">
</div> <small>{{ error }}</small>
</li>
</ul>
</div>
<div class="matches" v-else-if="!samePasswords">
<p>
{{ $t('site.signup.dont_match') }}
<i class="ni ni-active-40" color="danger"></i>
</p>
</div>
</transition>
<b-row class="my-4"> <b-row class="my-4">
<b-col cols="12"> <b-col cols="12">
<base-input <base-input
@ -79,17 +108,22 @@
name="Privacy Policy" name="Privacy Policy"
> >
<b-form-checkbox v-model="model.agree"> <b-form-checkbox v-model="model.agree">
<span class="text-muted"> <span class="text-muted" v-html="$t('site.signup.agree')"></span>
<a href="https://gradido.net/de/datenschutz/" target="_blank">
{{ $t('privacy_policy') }}
</a>
- {{ $t('site.signup.agree') }}
</span>
</b-form-checkbox> </b-form-checkbox>
</base-input> </base-input>
</b-col> </b-col>
</b-row> </b-row>
<div class="text-center"> <div
class="text-center"
v-if="
passwordsFilled &&
samePasswords &&
passwordValidation.valid &&
namesFilled &&
emailFilled &&
model.agree
"
>
<b-button type="submit" variant="secondary" class="mt-4"> <b-button type="submit" variant="secondary" class="mt-4">
{{ $t('signup') }} {{ $t('signup') }}
</b-button> </b-button>
@ -101,7 +135,7 @@
</b-col> </b-col>
</b-row> </b-row>
<div class="text-center py-lg-4"> <div class="text-center py-lg-4">
<router-link to="/Login" class="mt-3">{{ $t('back') }}</router-link> <router-link to="/login" class="mt-3">{{ $t('back') }}</router-link>
</div> </div>
</b-container> </b-container>
</div> </div>
@ -115,15 +149,25 @@ export default {
firstname: '', firstname: '',
lastname: '', lastname: '',
email: '', email: '',
password: '',
password2: '',
agree: false, agree: false,
}, },
rules: [
{ message: this.$t('site.signup.lowercase'), regex: /[a-z]+/ },
{ message: this.$t('site.signup.uppercase'), regex: /[A-Z]+/ },
{ message: this.$t('site.signup.minimum'), regex: /.{8,}/ },
{ message: this.$t('site.signup.one_number'), regex: /[0-9]+/ },
],
password: '',
checkPassword: '',
passwordVisible: false,
submitted: false,
} }
}, },
methods: { methods: {
togglePasswordVisibility() {
this.passwordVisible = !this.passwordVisible
},
onSubmit() { onSubmit() {
// console.log("this.modals =>", this.modals)
this.$store.dispatch('createUser', { this.$store.dispatch('createUser', {
email: this.model.email, email: this.model.email,
first_name: this.model.firstname, first_name: this.model.firstname,
@ -138,6 +182,37 @@ export default {
this.$router.push('/thx') this.$router.push('/thx')
}, },
}, },
computed: {
samePasswords() {
return this.password === this.checkPassword
},
passwordsFilled() {
return this.password !== '' && this.checkPassword !== ''
},
namesFilled() {
return (
this.model.firstname !== '' &&
this.model.firstname.length > 2 &&
this.model.lastname !== '' &&
this.model.lastname.length > 1
)
},
emailFilled() {
return this.model.email !== ''
},
passwordValidation() {
let errors = []
for (let condition of this.rules) {
if (!condition.regex.test(this.password)) {
errors.push(condition.message)
}
}
if (errors.length === 0) {
return { valid: true, errors }
}
return { valid: false, errors }
},
},
} }
</script> </script>
<style></style> <style></style>

View File

@ -0,0 +1,107 @@
import { mount, RouterLinkStub } from '@vue/test-utils'
import Vuex from 'vuex'
import flushPromises from 'flush-promises'
import ResetPassword from './ResetPassword'
const localVue = global.localVue
describe('ResetPassword', () => {
let wrapper
let mocks = {
$i18n: {
locale: 'en',
},
$t: jest.fn((t) => t),
}
let state = {
// loginfail: false,
}
let store = new Vuex.Store({
state,
})
let stubs = {
RouterLink: RouterLinkStub,
}
const Wrapper = () => {
return mount(ResetPassword, { localVue, mocks, store, stubs })
}
describe('mount', () => {
beforeEach(() => {
wrapper = Wrapper()
})
it('renders the Reset Password form', () => {
expect(wrapper.find('div.resetpwd-form').exists()).toBeTruthy()
})
//describe('Register header', () => {
// it('has a welcome message', () => {
// expect(wrapper.find('div.header').text()).toBe('site.signup.title site.signup.subtitle')
// })
//})
//describe('links', () => {
// it('has a link "Back"', () => {
// expect(wrapper.findAllComponents(RouterLinkStub).at(0).text()).toEqual('back')
// })
// it('links to /login when clicking "Back"', () => {
// expect(wrapper.findAllComponents(RouterLinkStub).at(0).props().to).toBe('/login')
// })
//})
//describe('Register form', () => {
// it('has a register form', () => {
// expect(wrapper.find('form').exists()).toBeTruthy()
// })
// it('has 3 text input fields', () => {
// expect(wrapper.findAll('input[type="text"]').length).toBe(3)
// })
// it('has 2 password input fields', () => {
// expect(wrapper.findAll('input[type="password"]').length).toBe(2)
// })
// it('has 1 checkbox input fields', () => {
// expect(wrapper.findAll('input[type="checkbox"]').length).toBe(1)
// })
// it('has no submit button when not completely filled', () => {
// expect(wrapper.find('button[type="submit"]').exists()).toBe(false)
// })
// it('shows a warning when no valid Email is entered', async () => {
// wrapper.findAll('input[type="text"]').at(2).setValue('no_valid@Email')
// await flushPromises()
// await expect(wrapper.find('.invalid-feedback').text()).toEqual(
// 'The Email field must be a valid email',
// )
// })
// it('shows 4 warnings when no password is set', async () => {
// const passwords = wrapper.findAll('input[type="password"]')
// passwords.at(0).setValue('')
// passwords.at(1).setValue('')
// await flushPromises()
// await expect(wrapper.find('div.hints').text()).toContain(
// 'site.signup.lowercase',
// 'site.signup.uppercase',
// 'site.signup.minimum',
// 'site.signup.one_number',
// )
// })
// //TODO test different invalid password combinations
//})
// TODO test submit button
})
})

View File

@ -0,0 +1,147 @@
<template>
<div class="resetpwd-form">
<!-- Header -->
<div class="header p-4">
<b-container class="container">
<div class="header-body text-center mb-7">
<b-row class="justify-content-center">
<b-col xl="5" lg="6" md="8" class="px-2">
<h1>Reset Password</h1>
<div class="pb-4">
Jetzt kannst du ein neues Passwort speichern, mit welchem du dich zukünfitg in der
GRADIDO App anmelden kannst.
</div>
</b-col>
</b-row>
</div>
</b-container>
</div>
<!-- Page content -->
<b-container class="mt--8 p-1">
<!-- Table -->
<b-row class="justify-content-center">
<b-col lg="6" md="8">
<b-card no-body class="border-0" style="background-color: #ebebeba3 !important">
<b-card-body class="py-lg-4 px-sm-0 px-0 px-md-2 px-lg-4">
<validation-observer v-slot="{ handleSubmit }" ref="formValidator">
<b-form role="form" @submit.prevent="handleSubmit(onSubmit)">
<b-form-group :label="$t('form.password')">
<b-input-group>
<b-form-input
class="mb-0"
v-model="password"
name="password"
:class="{ valid: passwordValidation.valid }"
:type="passwordVisible ? 'text' : 'password'"
prepend-icon="ni ni-lock-circle-open"
:placeholder="$t('form.password')"
></b-form-input>
<b-input-group-append>
<b-button variant="outline-primary">
<b-icon
:icon="passwordVisible ? 'eye' : 'eye-slash'"
@click="togglePasswordVisibility"
/>
</b-button>
</b-input-group-append>
</b-input-group>
</b-form-group>
<base-input
:label="$t('form.password_repeat')"
type="password"
name="password-repeat"
:placeholder="$t('form.password_repeat')"
prepend-icon="ni ni-lock-circle-open"
v-model.lazy="checkPassword"
:class="{ valid: passwordValidation.valid }"
/>
<transition name="hint" appear>
<div v-if="passwordValidation.errors.length > 0 && !submitted" class="hints">
<ul>
<li v-for="error in passwordValidation.errors" :key="error">
<small>{{ error }}</small>
</li>
</ul>
</div>
<div class="matches" v-else-if="!samePasswords">
<p>
{{ $t('site.signup.dont_match') }}
<i class="ni ni-active-40" color="danger"></i>
</p>
</div>
</transition>
<div
class="text-center"
v-if="passwordsFilled && samePasswords && passwordValidation.valid"
>
<b-button type="submit" variant="secondary" class="mt-4">
{{ $t('signup') }}
</b-button>
</div>
</b-form>
</validation-observer>
</b-card-body>
</b-card>
</b-col>
</b-row>
</b-container>
</div>
</template>
<script>
export default {
name: 'reset',
data() {
return {
rules: [
{ message: this.$t('site.signup.lowercase'), regex: /[a-z]+/ },
{ message: this.$t('site.signup.uppercase'), regex: /[A-Z]+/ },
{ message: this.$t('site.signup.minimum'), regex: /.{8,}/ },
{ message: this.$t('site.signup.one_number'), regex: /[0-9]+/ },
],
password: '',
checkPassword: '',
passwordVisible: false,
submitted: false,
}
},
methods: {
togglePasswordVisibility() {
this.passwordVisible = !this.passwordVisible
},
onSubmit() {
this.$store.dispatch('createUser', {
password: this.model.password,
})
this.model.password = ''
this.$router.push('/thx')
},
},
computed: {
samePasswords() {
return this.password === this.checkPassword
},
passwordsFilled() {
return this.password !== '' && this.checkPassword !== ''
},
passwordValidation() {
let errors = []
for (let condition of this.rules) {
if (!condition.regex.test(this.password)) {
errors.push(condition.message)
}
}
if (errors.length === 0) {
return { valid: true, errors }
}
return { valid: false, errors }
},
},
created() {
//console.log('resetpage', this.$route)
},
}
</script>
<style></style>

View File

@ -1,47 +1,36 @@
######################################################################################################### #########################################################################################################
# Build release # Build release
######################################################################################################### #########################################################################################################
From conanio/gcc7 as release From conanio/gcc9 as release
ENV DOCKER_WORKDIR="/code" ENV DOCKER_WORKDIR="/code"
USER root USER root
COPY --from=unicorny/protoc:3.9.1 /usr/bin/protoc /usr/bin/
COPY --from=unicorny/protoc:3.9.1 /usr/lib/libprotobuf.so.20 /usr/lib/libprotobuf.so.20
COPY --from=unicorny/protoc:3.9.1 /usr/lib/libprotoc.so.20 /usr/lib/libprotoc.so.20
COPY --from=unicorny/protoc:3.9.1 /usr/include/google/protobuf/* /usr/include/google/protobuf/
RUN mkdir -p ${DOCKER_WORKDIR} RUN mkdir -p ${DOCKER_WORKDIR}
WORKDIR ${DOCKER_WORKDIR} WORKDIR ${DOCKER_WORKDIR}
COPY . . COPY . .
#RUN git submodule update --init --recursive
RUN ls -la
RUN cd dependencies/iroha-ed25519 && \
ls -la && \
mkdir build && \
cd build && \
cmake .. -DEDIMPL=ref10 -DHASH=sha2_sphlib -DRANDOM=bcryptgen -DBUILD=STATIC && \
make -j$(nproc)
RUN cd dependencies/mariadb-connector-c && \ RUN cd dependencies/mariadb-connector-c && \
mkdir build && \ mkdir build && \
cd build && \ cd build && \
cmake -DWITH_SSL=OFF .. cmake -DWITH_SSL=OFF ..
RUN chmod +x compile_proto.sh RUN chmod +x compile_pot.sh && ./compile_pot.sh
RUN chmod +x compile_pot.sh
RUN ls -la
RUN ./compile_pot.sh
RUN ./compile_proto.sh
RUN mkdir build && \ RUN mkdir build && \
cd build && \ cd build && \
conan install .. --build=missing && \ conan install .. --build=missing && \
cmake .. && \ cmake .. && \
make -j$(nproc) Gradido_LoginServer make -j$(nproc) protoc grpc_cpp_plugin
RUN chmod +x unix_parse_proto.sh && ./unix_parse_proto.sh
RUN cd build && \
cmake .. && \
make -j$(nproc) Gradido_LoginServer
CMD ["./code"] CMD ["./code"]

View File

@ -192,7 +192,8 @@ void PendingTasksManager::checkForFinishedTasks(Poco::Timer& timer)
auto json = transaction->getModel()->getResultJson(); auto json = transaction->getModel()->getResultJson();
bool removeIt = false; bool removeIt = false;
if (!json.isNull()) { if (!json.isNull()) {
if (json->get("state").toString() == "success") { auto state = json->get("state");
if (!state.isEmpty() && state.toString() == "success") {
removeIt = true; removeIt = true;
} }
} }

@ -1 +1 @@
Subproject commit ff412f735667b30233c0ce00d461f209ac7dde7c Subproject commit 924b51c87fea29d5aaf053af43251dab44c2eeb7