diff --git a/pages/dashboard.vue b/pages/dashboard.vue
index 6c8bbcd..2859d42 100644
--- a/pages/dashboard.vue
+++ b/pages/dashboard.vue
@@ -1,24 +1,62 @@
-
-
-
- “First, solve the problem. Then, write the code.”
-
-
-
-
+
+
+
+
+ {{ id.toUpperCase() }} - {{ course.name }}
+
+
+
+
+ “First, solve the problem. Then, write the code.”
+
+
+
+
+
diff --git a/pages/index.vue b/pages/index.vue
index 72f02f4..99da4d0 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -18,9 +18,11 @@ export default {
this.$store.commit('initFirebase')
if (user) {
// User is signed in; redirect to main page (dashboard)
+ this.$store.commit('setUserLoggedIn', true)
this.$router.push({ name: 'dashboard' })
} else {
// User is signed out; redirect to login page
+ this.$store.commit('setUserLoggedIn', false)
this.$router.push({ name: 'login' })
}
})
diff --git a/pages/login.vue b/pages/login.vue
index 80f3a9f..927748f 100644
--- a/pages/login.vue
+++ b/pages/login.vue
@@ -1,6 +1,6 @@
-
-
+
+
Passwort vergessen?
-
+
-
+
Passwort zurücksetzen
@@ -139,7 +139,7 @@ export default {
email: '',
emailRules: [
v => !!v || this.defaultErrorReqField,
- v => /^\w+([.-]?\w+)*@(iu\.org|iubh-fernstudium\.de)+$/.test(v) || 'Keine gültige IU E-Mail-Adresse'
+ v => /^\w+([.-]?\w+)*@(iubh\.de|iubh-fernstudium\.de|iu\.org)+$/.test(v) || 'Keine gültige IU E-Mail-Adresse'
],
password: '',
passwordRules: [
diff --git a/plugins/firebase.js b/plugins/firebase.js
index a3aa173..c4a6971 100644
--- a/plugins/firebase.js
+++ b/plugins/firebase.js
@@ -1,5 +1,6 @@
import { initializeApp } from 'firebase/app'
import { getAuth } from 'firebase/auth'
+import { getFirestore } from 'firebase/firestore'
// Firebase configuration
const firebaseConfig = {
@@ -17,8 +18,12 @@ const app = initializeApp(firebaseConfig)
// Initialize Firebase Authentication and get a reference to the service
const auth = getAuth(app)
+// Initialize Cloud Firestore and get a reference to the service
+const db = getFirestore(app)
+
export default ({ app }, inject) => {
- // Inject $auth in Vue, context and store.
+ // Inject $auth and $db in Vue, context and store.
// Ref: https://nuxtjs.org/docs/directory-structure/plugins/
inject('auth', auth)
+ inject('db', db)
}
\ No newline at end of file
diff --git a/store/index.js b/store/index.js
index 951ad79..2ccdb5e 100644
--- a/store/index.js
+++ b/store/index.js
@@ -1,5 +1,7 @@
export const state = () => ({
- firebaseInitialized: false
+ firebaseInitialized: false,
+ userLoggedIn: false,
+ courses: []
})
export const getters = {
@@ -8,6 +10,12 @@ export const getters = {
export const mutations = {
initFirebase (state) {
state.firebaseInitialized = true
+ },
+ setUserLoggedIn (state, isLoggedIn) {
+ state.userLoggedIn = isLoggedIn
+ },
+ setCourses (state, courses) {
+ state.courses = courses
}
}