From 445c60bd650a3a1eb137b3c6f39b190596af0d8b Mon Sep 17 00:00:00 2001 From: Tobias Kurze Date: Tue, 28 Jul 2020 15:06:13 +0200 Subject: [PATCH] nicer login --- src/components/Login.vue | 127 +++++++++++++++++++++++++++------------ src/components/User.vue | 6 ++ src/main.ts | 9 +-- src/plugins/i18n.ts | 1 + 4 files changed, 100 insertions(+), 43 deletions(-) diff --git a/src/components/Login.vue b/src/components/Login.vue index d4c9661..bac1a2a 100644 --- a/src/components/Login.vue +++ b/src/components/Login.vue @@ -4,52 +4,83 @@
-
-

Login or Register

-

{{ errorMsg }}

-
-
- - -

Users

- - - OIDC with redirect -
-
-
-
- -
- +
+
+

Login or Register

+

{{ errorMsg }}

-
-
- -
- -
-
-
- Login - Register -
+ + + +

{{$t('Use your KIT account to connect to LRC. If this is your first login to LRC this creates a new account')}}!

+ + {{$t('Login with KIT account')}} +
+ +
+ +
+ +
+
+
+ +
+ +
+
+ +
+ Login +
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+ + +
+
+
+

{{ $t('You are already logged in!') }}

-

{{$t('Redirecting you to')}} {{redirectTarget}} {{$t('in')}} {{redirectTime}} {{$t('seconds')}}.

+

{{$t('Redirecting you to')}} + {{redirectTarget}} + {{$t('in')}} {{redirectTime}} {{$t('seconds')}}. +

{{$t('logout')}}

@@ -64,6 +95,8 @@ return { email: '', password: '', + regEmail: '', + regPassword: '', errorMsg: '', redirectMsg: '', redirectTarget: 'profile', @@ -78,7 +111,7 @@ .then(() => this.$router.push('/')); }, register() { - this.$store.dispatch('register', {email: this.email, password: this.password}) + this.$store.dispatch('register', {email: this.regEmail, password: this.regPassword}) .then(() => this.$router.push('/')); }, oidc_login() { @@ -88,6 +121,22 @@ this.$store.dispatch('logout', {revokeRefreshToken: true}); this.$router.push({name: 'home'}); }, + checkLoginForm(e) { + if (this.email && this.password){ + return true; + } + this.errors = []; + + if (!this.email){ + this.errors.push('E-Mail required') + } + + if (!this.password){ + this.errors.push('Password required') + } + + e.preventDefault(); + } }, mounted() { // this.$parent.$data.isLoading = true; diff --git a/src/components/User.vue b/src/components/User.vue index ea9d989..304050c 100644 --- a/src/components/User.vue +++ b/src/components/User.vue @@ -6,6 +6,12 @@

Manage users

{{users}}
+

Users

+
diff --git a/src/main.ts b/src/main.ts index 0bbf142..a1d1a0d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -64,6 +64,7 @@ import 'bootstrap/dist/css/bootstrap.css'; import 'bootstrap-vue/dist/bootstrap-vue.css'; const isProduction = process.env.NODE_ENV === 'production'; +Vue.prototype.$isProduction = isProduction; library.add(faCoffee, faTrash, faPencilAlt, faScroll, faCheck, faCircle, faList, faPlus, faDoorOpen, faCogs, faAt, faUser, faEnvelope, faUserTag, faExternalLinkAlt, faSync, faHome, faCode, faBarcode, faTag, faTags, faVideo, faLock, @@ -71,10 +72,10 @@ library.add(faCoffee, faTrash, faPencilAlt, faScroll, faCheck, faCircle, faList, Vue.component('font-awesome-icon', FontAwesomeIcon); -const options = { +const loggerOptions = { isEnabled: true, - // logLevel : isProduction ? 'error' : 'debug', - logLevel: 'debug', + logLevel : isProduction ? 'error' : 'debug', + //logLevel: 'debug', stringifyArguments: false, showLogLevel: true, showMethodName: true, @@ -82,7 +83,7 @@ const options = { showConsoleColors: true, }; -Vue.use(VueLogger, options); +Vue.use(VueLogger, loggerOptions); Vue.use(VueAxios, axios); Vue.use(BootstrapVue); Vue.use(FlagIcon); diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts index 446f9dc..fda3514 100644 --- a/src/plugins/i18n.ts +++ b/src/plugins/i18n.ts @@ -24,6 +24,7 @@ const messages = { recorder: 'Aufzeichnungsgerät', Recorders: 'Aufzeichnungsgeräte', recorders: 'Aufzeichnungsgeräte', + Register: 'Registrieren', command: 'Befehl', commands: 'Befehle', Commands: 'Befehle',