diff --git a/ios/App/App/Info.plist b/ios/App/App/Info.plist index 392fe82..ee6faae 100644 --- a/ios/App/App/Info.plist +++ b/ios/App/App/Info.plist @@ -60,5 +60,10 @@ UIViewControllerBasedStatusBarAppearance + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + diff --git a/ios/App/Podfile b/ios/App/Podfile index 6006b02..e0e2f1d 100644 --- a/ios/App/Podfile +++ b/ios/App/Podfile @@ -11,6 +11,7 @@ install! 'cocoapods', :disable_input_output_paths => true def capacitor_pods pod 'Capacitor', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' + pod 'CapacitorBrowser', :path => '../../node_modules/@capacitor/browser' pod 'CapacitorDevice', :path => '../../node_modules/@capacitor/device' pod 'CapacitorNetwork', :path => '../../node_modules/@capacitor/network' pod 'CapacitorPreferences', :path => '../../node_modules/@capacitor/preferences' @@ -24,7 +25,15 @@ target 'App' do end post_install do |installer| - assertDeploymentTarget(installer) + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + # iOS Deployment Target erzwingen + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0' + + # Alle Warnungen auf inherited setzen, falls Pods Dinge überschreiben + config.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] = '$(inherited)' + end + end end target 'OneSignalNotificationServiceExtension' do diff --git a/ios/App/Podfile.lock b/ios/App/Podfile.lock deleted file mode 100644 index 3d267bf..0000000 --- a/ios/App/Podfile.lock +++ /dev/null @@ -1,105 +0,0 @@ -PODS: - - Capacitor (7.1.0): - - CapacitorCordova - - CapacitorCordova (7.1.0) - - CapacitorDevice (7.0.0): - - Capacitor - - CapacitorNetwork (7.0.0): - - Capacitor - - CapacitorPluginSafeArea (4.0.0): - - Capacitor - - CapacitorPreferences (6.0.3): - - Capacitor - - CordovaPluginsStatic (7.1.0): - - CapacitorCordova - - OneSignalXCFramework (= 5.2.10) - - OneSignalXCFramework (5.2.10): - - OneSignalXCFramework/OneSignalComplete (= 5.2.10) - - OneSignalXCFramework/OneSignal (5.2.10): - - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalExtension - - OneSignalXCFramework/OneSignalLiveActivities - - OneSignalXCFramework/OneSignalNotifications - - OneSignalXCFramework/OneSignalOSCore - - OneSignalXCFramework/OneSignalOutcomes - - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalComplete (5.2.10): - - OneSignalXCFramework/OneSignal - - OneSignalXCFramework/OneSignalInAppMessages - - OneSignalXCFramework/OneSignalLocation - - OneSignalXCFramework/OneSignalCore (5.2.10) - - OneSignalXCFramework/OneSignalExtension (5.2.10): - - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalOutcomes - - OneSignalXCFramework/OneSignalInAppMessages (5.2.10): - - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalNotifications - - OneSignalXCFramework/OneSignalOSCore - - OneSignalXCFramework/OneSignalOutcomes - - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalLiveActivities (5.2.10): - - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalOSCore - - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalLocation (5.2.10): - - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalNotifications - - OneSignalXCFramework/OneSignalOSCore - - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalNotifications (5.2.10): - - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalExtension - - OneSignalXCFramework/OneSignalOutcomes - - OneSignalXCFramework/OneSignalOSCore (5.2.10): - - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalOutcomes (5.2.10): - - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalUser (5.2.10): - - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalNotifications - - OneSignalXCFramework/OneSignalOSCore - - OneSignalXCFramework/OneSignalOutcomes - -DEPENDENCIES: - - "Capacitor (from `../../node_modules/@capacitor/ios`)" - - "CapacitorCordova (from `../../node_modules/@capacitor/ios`)" - - "CapacitorDevice (from `../../node_modules/@capacitor/device`)" - - "CapacitorNetwork (from `../../node_modules/@capacitor/network`)" - - CapacitorPluginSafeArea (from `../../node_modules/capacitor-plugin-safe-area`) - - "CapacitorPreferences (from `../../node_modules/@capacitor/preferences`)" - - CordovaPluginsStatic (from `../capacitor-cordova-ios-plugins`) - - OneSignalXCFramework (< 6.0, >= 5.0) - -SPEC REPOS: - trunk: - - OneSignalXCFramework - -EXTERNAL SOURCES: - Capacitor: - :path: "../../node_modules/@capacitor/ios" - CapacitorCordova: - :path: "../../node_modules/@capacitor/ios" - CapacitorDevice: - :path: "../../node_modules/@capacitor/device" - CapacitorNetwork: - :path: "../../node_modules/@capacitor/network" - CapacitorPluginSafeArea: - :path: "../../node_modules/capacitor-plugin-safe-area" - CapacitorPreferences: - :path: "../../node_modules/@capacitor/preferences" - CordovaPluginsStatic: - :path: "../capacitor-cordova-ios-plugins" - -SPEC CHECKSUMS: - Capacitor: bceb785fb78f5e81e4a9e37843bc1c24bd9c7194 - CapacitorCordova: 866217f32c1d25b326c568a10ea3ed0c36b13e29 - CapacitorDevice: 069faf433b3a99c3d5f0e500fbe634f60a8c6a84 - CapacitorNetwork: 30c2e78a0ed32530656cb426c8ee6c2caec10dbf - CapacitorPluginSafeArea: 22031c3436269ca80fac90ec2c94bc7c1e59a81d - CapacitorPreferences: f3eadae2369ac3ab8e21743a2959145b0d1286a3 - CordovaPluginsStatic: f722d4ff434f50099581e690d579b7c108f490e6 - OneSignalXCFramework: 1a3b28dfbff23aabce585796d23c1bef37772774 - -PODFILE CHECKSUM: d76fcd3d35c3f8c3708303de70ef45a76cc6e2b5 - -COCOAPODS: 1.16.2 diff --git a/layouts/mobile.vue b/layouts/mobile.vue index c014d8e..cb232c1 100644 --- a/layouts/mobile.vue +++ b/layouts/mobile.vue @@ -2,6 +2,7 @@ import { ref, onMounted, onBeforeUnmount } from "vue" import dayjs from "dayjs"; +import {useAuthStore} from "~/stores/auth.js"; const route = useRoute() const auth = useAuthStore() @@ -234,9 +235,9 @@ onBeforeUnmount(() => { class="w-1/3 mx-auto my-10" v-else /> -
+
-

Kein Aktiver Mandant. Bitte wählen Sie ein Mandant.

+

Kein Aktiver Mandant.
Bitte wählen Sie ein Mandant.

{{tenant.name}} {
- + Test + {{auth.tenants}} + + Abmelden
diff --git a/middleware/auth.global.ts b/middleware/auth.global.ts index 8d0d033..c03e09a 100644 --- a/middleware/auth.global.ts +++ b/middleware/auth.global.ts @@ -1,6 +1,9 @@ export default defineNuxtRouteMiddleware(async (to, from) => { const auth = useAuthStore() + console.log(auth) + + if (auth.loading) return // Wenn nicht eingeloggt → auf /login (außer er will schon dahin) diff --git a/package.json b/package.json index 0103f48..cc0dc96 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ }, "dependencies": { "@capacitor/android": "^7.0.0", + "@capacitor/browser": "^7.0.2", "@capacitor/core": "^7.0.0", "@capacitor/device": "^7.0.0", "@capacitor/ios": "^7.0.0", @@ -66,7 +67,7 @@ "maplibre-gl": "^4.7.0", "nuxt-editorjs": "^1.0.4", "nuxt-viewport": "^2.0.6", - "onesignal-cordova-plugin": "^5.2.11", + "onesignal-cordova-plugin": "^5.2.14", "papaparse": "^5.4.1", "pdf-lib": "^1.17.1", "pinia": "^2.1.7", diff --git a/pages/login.vue b/pages/login.vue index 09ae74e..70f0b2a 100644 --- a/pages/login.vue +++ b/pages/login.vue @@ -5,6 +5,7 @@ definePageMeta({ const auth = useAuthStore() const toast = useToast() +const router = useRouter() const platformIsNative = useCapacitor().getIsNative() @@ -15,9 +16,9 @@ const doLogin = async (data:any) => { // Weiterleiten nach erfolgreichem Login toast.add({title:"Einloggen erfolgreich"}) if(platformIsNative) { - return navigateTo("/mobile") + await router.push("/mobile") } else { - return navigateTo("/") + await router.push("/") } } catch (err: any) { toast.add({title:"Zugangsdaten falsch. Bitte überprüfen Sie Ihre Eingaben",color:"rose"}) diff --git a/plugins/api.ts b/plugins/api.ts index 7853e35..62fca69 100644 --- a/plugins/api.ts +++ b/plugins/api.ts @@ -4,12 +4,12 @@ export default defineNuxtPlugin(() => { const config = useRuntimeConfig() const api = $fetch.create({ - baseURL: config.public.apiBase,/*"http://192.168.1.227:3100" "https://backend.fedeo.io"*/ + baseURL: config.public.apiBase, credentials: "include", async onRequest({options}) { // Token aus Cookie holen let token: string | null | undefined = "" - if (await useCapacitor().getIsNative()) { + if (useCapacitor().getIsNative()) { const {value} = await Preferences.get({key: 'token'}); token = value } else { diff --git a/stores/auth.ts b/stores/auth.ts index 29f43dc..f01f5ca 100644 --- a/stores/auth.ts +++ b/stores/auth.ts @@ -63,13 +63,18 @@ export const useAuthStore = defineStore("auth", { }, async login(email: string, password: string) { - console.log("Auth login") - const { token } = await useNuxtApp().$api("/auth/login", { - method: "POST", - body: { email, password } - }) - console.log(token) - await this.fetchMe(token) + try { + console.log("Auth login") + const { token } = await useNuxtApp().$api("/auth/login", { + method: "POST", + body: { email, password } + }) + console.log("Token: " + token) + await this.fetchMe(token) + } catch (e) { + console.log("login error:" + e) + } + }, async logout() { @@ -105,6 +110,7 @@ export const useAuthStore = defineStore("auth", { jwt }} }) + console.log(me) this.user = me.user this.permissions = me.permissions this.tenants = me.tenants @@ -143,7 +149,7 @@ export const useAuthStore = defineStore("auth", { const {token} = res - if(await useCapacitor().getIsNative()) { + if(useCapacitor().getIsNative()) { await Preferences.set({ key:"token", value: token,