diff --git a/frontend/package.json b/frontend/package.json index 34ce37b76..910644e2c 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -51,6 +51,7 @@ "nouislider": "^12.1.0", "particles-bg-vue": "1.2.3", "perfect-scrollbar": "^1.3.0", + "portal-vue": "^2.1.7", "prettier": "^2.2.1", "qrcode": "^1.4.4", "quill": "^1.3.6", @@ -58,6 +59,7 @@ "sweetalert2": "^9.5.4", "vee-validate": "^3.4.5", "vue": "^2.6.11", + "vue-bootstrap-toasts": "^1.0.7", "vue-bootstrap-typeahead": "^0.2.6", "vue-chartjs": "^3.5.0", "vue-cli-plugin-i18n": "^1.0.1", diff --git a/frontend/src/App.vue b/frontend/src/App.vue index a6613bec1..500a7b2e1 100755 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -3,6 +3,7 @@
+
diff --git a/frontend/src/apis/loginAPI.js b/frontend/src/apis/loginAPI.js index 2eeec754e..3453bd296 100644 --- a/frontend/src/apis/loginAPI.js +++ b/frontend/src/apis/loginAPI.js @@ -98,7 +98,6 @@ const loginAPI = { } return apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload) }, - changePassword: async (sessionId, email, password) => { const payload = { session_id: sessionId, diff --git a/frontend/src/assets/scss/argon.scss b/frontend/src/assets/scss/argon.scss index 01a002691..1fa663a5f 100644 --- a/frontend/src/assets/scss/argon.scss +++ b/frontend/src/assets/scss/argon.scss @@ -23,38 +23,95 @@ // Bootstrap (4.1.3) components -@import "~bootstrap/scss/root"; -@import "~bootstrap/scss/reboot"; -@import "~bootstrap/scss/type"; -@import "~bootstrap/scss/images"; -@import "~bootstrap/scss/code"; -@import "~bootstrap/scss/grid"; -@import "~bootstrap/scss/tables"; -@import "~bootstrap/scss/forms"; -@import "~bootstrap/scss/buttons"; -@import "~bootstrap/scss/transitions"; -@import "~bootstrap/scss/dropdown"; +@import "~bootstrap/scss/alert"; +@import "~bootstrap/scss/badge"; +@import "~bootstrap/scss/breadcrumb"; @import "~bootstrap/scss/button-group"; -@import "~bootstrap/scss/input-group"; +@import "~bootstrap/scss/buttons"; +@import "~bootstrap/scss/card"; +@import "~bootstrap/scss/carousel"; +@import "~bootstrap/scss/close"; +@import "~bootstrap/scss/code"; @import "~bootstrap/scss/custom-forms"; +@import "~bootstrap/scss/dropdown"; +@import "~bootstrap/scss/forms"; +@import "~bootstrap/scss/grid"; +@import "~bootstrap/scss/images"; +@import "~bootstrap/scss/input-group"; +@import "~bootstrap/scss/jumbotron"; +@import "~bootstrap/scss/list-group"; +@import "~bootstrap/scss/media"; +@import "~bootstrap/scss/modal"; @import "~bootstrap/scss/nav"; @import "~bootstrap/scss/navbar"; -@import "~bootstrap/scss/card"; -@import "~bootstrap/scss/breadcrumb"; @import "~bootstrap/scss/pagination"; -@import "~bootstrap/scss/badge"; -@import "~bootstrap/scss/jumbotron"; -@import "~bootstrap/scss/alert"; -@import "~bootstrap/scss/progress"; -@import "~bootstrap/scss/media"; -@import "~bootstrap/scss/list-group"; -@import "~bootstrap/scss/close"; -@import "~bootstrap/scss/modal"; -@import "~bootstrap/scss/tooltip"; @import "~bootstrap/scss/popover"; -@import "~bootstrap/scss/carousel"; -@import "~bootstrap/scss/utilities"; @import "~bootstrap/scss/print"; +@import "~bootstrap/scss/progress"; +@import "~bootstrap/scss/reboot"; +@import "~bootstrap/scss/root"; +@import "~bootstrap/scss/tables"; +@import "~bootstrap/scss/toasts"; +@import "~bootstrap/scss/tooltip"; +@import "~bootstrap/scss/transitions"; +@import "~bootstrap/scss/type"; +@import "~bootstrap/scss/utilities"; +@import "~bootstrap/scss/variables"; + +// Utilities + +@import "~bootstrap/scss/utilities/align"; +@import "~bootstrap/scss/utilities/background"; +@import "~bootstrap/scss/utilities/borders"; +@import "~bootstrap/scss/utilities/clearfix"; +@import "~bootstrap/scss/utilities/display"; +@import "~bootstrap/scss/utilities/embed"; +@import "~bootstrap/scss/utilities/flex"; +@import "~bootstrap/scss/utilities/float"; +@import "~bootstrap/scss/utilities/overflow"; +@import "~bootstrap/scss/utilities/position"; +@import "~bootstrap/scss/utilities/screenreaders"; +@import "~bootstrap/scss/utilities/shadows"; +@import "~bootstrap/scss/utilities/sizing"; +@import "~bootstrap/scss/utilities/spacing"; +@import "~bootstrap/scss/utilities/stretched-link"; +@import "~bootstrap/scss/utilities/text"; +@import "~bootstrap/scss/utilities/visibility"; + + +// Mixins + +@import "~bootstrap/scss/mixins/alert"; +@import "~bootstrap/scss/mixins/badge"; +@import "~bootstrap/scss/mixins/border-radius"; +@import "~bootstrap/scss/mixins/box-shadow"; +@import "~bootstrap/scss/mixins/breakpoints"; +@import "~bootstrap/scss/mixins/buttons"; +@import "~bootstrap/scss/mixins/caret"; +@import "~bootstrap/scss/mixins/clearfix"; +@import "~bootstrap/scss/mixins/deprecate"; +@import "~bootstrap/scss/mixins/float"; +@import "~bootstrap/scss/mixins/forms"; +@import "~bootstrap/scss/mixins/gradients"; +@import "~bootstrap/scss/mixins/grid-framework"; +@import "~bootstrap/scss/mixins/grid"; +@import "~bootstrap/scss/mixins/hover"; +@import "~bootstrap/scss/mixins/image"; +@import "~bootstrap/scss/mixins/list-group"; +@import "~bootstrap/scss/mixins/lists"; +@import "~bootstrap/scss/mixins/nav-divider"; +@import "~bootstrap/scss/mixins/pagination"; +@import "~bootstrap/scss/mixins/reset-text"; +@import "~bootstrap/scss/mixins/resize"; +@import "~bootstrap/scss/mixins/screen-reader"; +@import "~bootstrap/scss/mixins/size"; +@import "~bootstrap/scss/mixins/table-row"; +@import "~bootstrap/scss/mixins/text-emphasis"; +@import "~bootstrap/scss/mixins/text-hide"; +@import "~bootstrap/scss/mixins/text-truncate"; +@import "~bootstrap/scss/mixins/transition"; +@import "~bootstrap/scss/mixins/visibility"; + // Argon utilities and components diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index f47493aea..f358d3169 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -109,7 +109,10 @@ "chart":"Gemeinschaftsstunden Chart", "new":"Neue Gemeinschaftsstunden eintragen", "list":"Meine Gemeinschaftsstunden Liste" - } + }, + "user-data": { + "change-success": "Deine Daten wurden gespeichert." + } }, "navbar" : { "my-profil":"Mein Profil", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index dbb9b445c..edee8c8c3 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -110,7 +110,10 @@ "chart":"Community Hours Chart", "new":"Register new community hours", "list":"My Community Hours List" - } + }, + "user-data": { + "change-success": "Your data has been saved." + } }, "navbar" : { "my-profil":"My profile", diff --git a/frontend/src/plugins/dashboard-plugin.js b/frontend/src/plugins/dashboard-plugin.js index b7c0ea06c..013ded702 100755 --- a/frontend/src/plugins/dashboard-plugin.js +++ b/frontend/src/plugins/dashboard-plugin.js @@ -11,6 +11,10 @@ import GlobalDirectives from './globalDirectives' // Sidebar on the right. Used as a local plugin in DashboardLayout.vue import SideBar from '@/components/SidebarPlugin' +import PortalVue from 'portal-vue' + +import VueBootstrapToasts from 'vue-bootstrap-toasts' + // vue-bootstrap import { BootstrapVue, IconsPlugin } from 'bootstrap-vue' @@ -47,8 +51,10 @@ export default { Vue.use(GlobalDirectives) Vue.use(SideBar) Vue.use(Notifications) + Vue.use(PortalVue) Vue.use(BootstrapVue) Vue.use(IconsPlugin) + Vue.use(VueBootstrapToasts) Vue.use(VueGoodTablePlugin) Vue.use(VueMoment) Vue.use(VueQrcodeReader) diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.vue b/frontend/src/views/Layout/DashboardLayout_gdd.vue index 564b4e430..66814b733 100755 --- a/frontend/src/views/Layout/DashboardLayout_gdd.vue +++ b/frontend/src/views/Layout/DashboardLayout_gdd.vue @@ -34,7 +34,6 @@ :transactions="transactions" :transactionCount="transactionCount" :pending="pending" - :UserProfileTestData="UserProfileTestData" @update-balance="updateBalance" @update-transactions="updateTransactions" > @@ -86,11 +85,6 @@ export default { bookedBalance: 0, transactionCount: 0, pending: true, - UserProfileTestData: { - username: 'Mustermax', - desc: - 'Max Mustermann seine Beschreibung. Max Mustermann seine Beschreibung. Max Mustermann seine Beschreibung. Max Mustermann seine Beschreibung. ', - }, } }, methods: { diff --git a/frontend/src/views/Pages/ForgotPassword.vue b/frontend/src/views/Pages/ForgotPassword.vue index 32331d080..75fc65048 100644 --- a/frontend/src/views/Pages/ForgotPassword.vue +++ b/frontend/src/views/Pages/ForgotPassword.vue @@ -58,14 +58,12 @@ export default { }, } }, + created() {}, methods: { async onSubmit() { - const result = await loginAPI.sendEmail(this.form.email) - if (result.success) { - this.$router.push('/thx/password') - } else { - alert(result.result) - } + await loginAPI.sendEmail(this.form.email) + // always give success to avoid email spying + this.$router.push('/thx/password') }, }, } diff --git a/frontend/src/views/Pages/ResetPassword.vue b/frontend/src/views/Pages/ResetPassword.vue index 99892612c..2647e8fa0 100644 --- a/frontend/src/views/Pages/ResetPassword.vue +++ b/frontend/src/views/Pages/ResetPassword.vue @@ -108,14 +108,14 @@ export default { if (result.success) { this.password = '' /* - this.$store.dispatch('login', { - sessionId: result.result.data.session_id, - email: result.result.data.user.email, - }) - */ + this.$store.dispatch('login', { + sessionId: result.result.data.session_id, + email: result.result.data.user.email, + }) + */ this.$router.push('/thx/reset') } else { - alert(result.result.message) + this.$toast.error(result.result.message) } }, async authenticate() { @@ -126,7 +126,7 @@ export default { this.sessionId = result.result.data.session_id this.email = result.result.data.user.email } else { - alert(result.result.message) + this.$toast.error(result.result.message) } }, }, diff --git a/frontend/src/views/Pages/UserProfile.spec.js b/frontend/src/views/Pages/UserProfile.spec.js deleted file mode 100644 index 7716be9cf..000000000 --- a/frontend/src/views/Pages/UserProfile.spec.js +++ /dev/null @@ -1,23 +0,0 @@ -import { shallowMount } from '@vue/test-utils' - -import UserProfile from './UserProfile' - -const localVue = global.localVue - -describe('UserProfile', () => { - let wrapper - - const Wrapper = () => { - return shallowMount(UserProfile, { localVue }) - } - - describe('shallowMount', () => { - beforeEach(() => { - wrapper = Wrapper() - }) - - it('renders the component', () => { - expect(wrapper.findComponent({ name: 'user-card' }).exists()).toBeTruthy() - }) - }) -}) diff --git a/frontend/src/views/Pages/UserProfile.vue b/frontend/src/views/Pages/UserProfile.vue deleted file mode 100644 index 882b52e78..000000000 --- a/frontend/src/views/Pages/UserProfile.vue +++ /dev/null @@ -1,28 +0,0 @@ - - - diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue b/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue index e07313c96..1fa26b5e0 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue @@ -9,8 +9,8 @@ @@ -19,7 +19,7 @@ {{ $t('form.firstname') }} - - {{ $store.state.firstName }} + + {{ form.firstName }} @@ -45,8 +45,8 @@ {{ $t('form.lastname') }} - - {{ $store.state.lastName }} + + {{ form.lastName }} @@ -56,15 +56,15 @@ {{ $t('form.description') }} - - {{ $store.state.description }} + + {{ form.description }} - +
{ + let wrapper + + const mocks = { + $t: jest.fn((t) => t), + } + + const Wrapper = () => { + return shallowMount(UserProfileOverview, { localVue, mocks }) + } + + describe('shallow Mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('has a user card', () => { + expect(wrapper.findComponent({ name: 'UserCard' }).exists()).toBeTruthy() + }) + + it('has a user data form', () => { + expect(wrapper.findComponent({ name: 'FormUserData' }).exists()).toBeTruthy() + }) + + it('has a user name form', () => { + expect(wrapper.findComponent({ name: 'FormUsername' }).exists()).toBeTruthy() + }) + + it('has a user password form', () => { + expect(wrapper.findComponent({ name: 'FormUserPasswort' }).exists()).toBeTruthy() + }) + }) +}) diff --git a/frontend/src/views/Pages/UserProfileOverview.vue b/frontend/src/views/Pages/UserProfileOverview.vue index def5289cb..0708a2329 100644 --- a/frontend/src/views/Pages/UserProfileOverview.vue +++ b/frontend/src/views/Pages/UserProfileOverview.vue @@ -1,7 +1,7 @@