From 03ba88d7c74c7051ac3d0baf133a87e4b3775d4d Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 23 Mar 2021 19:25:20 +0100 Subject: [PATCH 1/7] vee-validation to v3.4.5 --- frontend/package.json | 2 +- frontend/yarn.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 2ebf5c1a2..621c6846f 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -39,7 +39,7 @@ "qrcode": "^1.4.4", "quill": "^1.3.6", "sweetalert2": "^9.5.4", - "vee-validate": "^3.2.1", + "vee-validate": "^3.4.5", "vue": "^2.6.11", "vue-bootstrap-typeahead": "^0.2.6", "vue-chartjs": "^3.5.0", diff --git a/frontend/yarn.lock b/frontend/yarn.lock index cf52833bf..6b1d84e1e 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -11220,7 +11220,7 @@ vary@~1.1.2: resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= -vee-validate@^3.2.1: +vee-validate@^3.4.5: version "3.4.5" resolved "https://registry.yarnpkg.com/vee-validate/-/vee-validate-3.4.5.tgz#96a456c309f7bdb2cce62c3b554f96d893e9f6ae" integrity sha512-ZEcLqOAZzSkMhDvPcTx0xcwVOijFnMW9J+BA20j+rDmo24T8RCCqVQyRwwrDrcWJZV2dRYl/yYNa2GB6UCoBvg== From e1488e834e378f602523f4cd77a037446edcb04c Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 23 Mar 2021 19:29:12 +0100 Subject: [PATCH 2/7] localize error messages from vee-validate --- frontend/src/i18n.js | 20 ++++++++++++---- frontend/src/locales/en.json | 44 ++++++++++++++++++------------------ frontend/src/main.js | 1 + frontend/src/vee-validate.js | 28 +++++++++++++++++++++++ 4 files changed, 66 insertions(+), 27 deletions(-) create mode 100644 frontend/src/vee-validate.js diff --git a/frontend/src/i18n.js b/frontend/src/i18n.js index 7b76454aa..b0f2f94b1 100644 --- a/frontend/src/i18n.js +++ b/frontend/src/i18n.js @@ -1,6 +1,9 @@ import Vue from 'vue' import VueI18n from 'vue-i18n' +import en from 'vee-validate/dist/locale/en' +import de from 'vee-validate/dist/locale/de' + Vue.use(VueI18n) function loadLocaleMessages () { @@ -11,6 +14,18 @@ function loadLocaleMessages () { if (matched && matched.length > 1) { const locale = matched[1] messages[locale] = locales(key) + if(locale === 'de') { + messages[locale] = { + validations: de, + ...messages[locale] + } + } + if(locale === 'en') { + messages[locale] = { + validations: en, + ...messages[locale] + } + } } }) return messages @@ -33,14 +48,9 @@ const numberFormats = { } } - export default new VueI18n({ locale: 'en', fallbackLocale: 'en', messages: loadLocaleMessages(), numberFormats }) - - - - \ No newline at end of file diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 2e6e9dbf7..21ece848a 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -11,8 +11,8 @@ "transactions":"transactions", "language":"Sprache", "languages":{ - "de": "Deutsch", - "en": "English" + "de": "Deutsch", + "en": "English" }, "form": { "cancel":"Cancel", @@ -74,32 +74,32 @@ "support":"Support" }, "sidebar" : { - "community":"Community", - "members_area":"Members area", - "membership":"Membership" + "community":"Community", + "members_area":"Members area", + "membership":"Membership" }, "landing1" : { - "explore":"Explore Gradido", - "text":"If you want to get inspiration or just show something directly to your clients, you can jump start your development with our pre-built example pages.", - "link":"Explore pages" + "explore":"Explore Gradido", + "text":"If you want to get inspiration or just show something directly to your clients, you can jump start your development with our pre-built example pages.", + "link":"Explore pages" }, "404" : { - "ooops" : "Ooops!", - "text" : "Page not found. Don't worry though, we have plenty of other pages to explore", - "back" : "Back to dashboard!" + "ooops" : "Ooops!", + "text" : "Page not found. Don't worry though, we have plenty of other pages to explore", + "back" : "Back to dashboard!" } -}, -"admin": { - "site": { - "overview": { - "creation": "Creation", - "transience" : "Transience", - "exchanged": "Exchanged", - "members" : "Members" + }, + "admin": { + "site": { + "overview": { + "creation": "Creation", + "transience" : "Transience", + "exchanged": "Exchanged", + "members" : "Members" + } } - } -}, + }, "nav": { "features": "Features" } -} \ No newline at end of file +} diff --git a/frontend/src/main.js b/frontend/src/main.js index 78d03e58f..63af33282 100755 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -2,6 +2,7 @@ import Vue from 'vue'; import DashboardPlugin from './plugins/dashboard-plugin'; import App from './App.vue'; import i18n from './i18n.js'; +import VeeValidate from './vee-validate.js' import VueCookies from 'vue-cookies'; // store diff --git a/frontend/src/vee-validate.js b/frontend/src/vee-validate.js new file mode 100644 index 000000000..d72679f18 --- /dev/null +++ b/frontend/src/vee-validate.js @@ -0,0 +1,28 @@ +import { configure, extend } from 'vee-validate' +import { required, email, min } from "vee-validate/dist/rules" +import i18n from './i18n' + + +configure({ + defaultMessage: (field, values) => { + console.log('defaultMessage', field, value) + values._field_ = i18n.t(`fields.${field}`) + return i18n.t(`validations.messages.${values._rule_}`, values) + } +}) + +extend('email', { + ...email, + message: (_, values) => i18n.t('validations.messages.email', values) +}) + +extend('required', { + ...required, + message: (_, values) => i18n.t('validations.messages.required', values) +}) + +extend('min', { + ...min, + message: (_, values) => i18n.t('validations.messages.min', values) +}) + From 106eb66c149d7c49cfcb3c81777d6e36fa13fafa Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 23 Mar 2021 19:29:53 +0100 Subject: [PATCH 3/7] update valiation messages when locale is switched --- frontend/src/views/Layout/AuthLayout_gdd.vue | 10 ++++----- frontend/src/views/Layout/ContentFooter.vue | 22 +++++++++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/frontend/src/views/Layout/AuthLayout_gdd.vue b/frontend/src/views/Layout/AuthLayout_gdd.vue index daf99a384..40b65c20d 100644 --- a/frontend/src/views/Layout/AuthLayout_gdd.vue +++ b/frontend/src/views/Layout/AuthLayout_gdd.vue @@ -3,18 +3,14 @@ From 4a94cba074247cfe33eeb6cd5f41bd7ce81f6c4a Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Wed, 24 Mar 2021 17:12:12 +0100 Subject: [PATCH 7/7] save response.html by community server error into /var/logs/grd_login folder, to have access to it if used with docker --- login_server/src/cpp/tasks/SigningTransaction.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/login_server/src/cpp/tasks/SigningTransaction.cpp b/login_server/src/cpp/tasks/SigningTransaction.cpp index f28946c0c..f25d37bb4 100644 --- a/login_server/src/cpp/tasks/SigningTransaction.cpp +++ b/login_server/src/cpp/tasks/SigningTransaction.cpp @@ -227,7 +227,13 @@ int SigningTransaction::run() { //printf("[JsonRequestHandler::handleRequest] Exception: %s\n", ex.displayText().data()); addError(new ParamError("SigningTransaction", "error parsing request answer", ex.displayText().data())); - FILE* f = fopen("response.html", "wt"); + std::string log_Path = "/var/log/grd_login/"; + //#ifdef _WIN32 +#if defined(_WIN32) || defined(_WIN64) + log_Path = "./"; +#endif + log_Path += "response.html"; + FILE* f = fopen(log_Path.data(), "wt"); if (f) { std::string responseString = responseStringStream.str(); fwrite(responseString.data(), 1, responseString.size(), f);