From 62397b90668ec8c96dfdad4721e0f3b131cedce7 Mon Sep 17 00:00:00 2001 From: richard-loafle <44828666+richard-loafle@users.noreply.github.com> Date: Mon, 30 Mar 2020 17:14:23 +0900 Subject: [PATCH] bug fixed --- package-lock.json | 361 ++++++++++++++++-- package.json | 22 +- src/app/app-provider.module.ts | 33 +- src/app/app-routing.module.ts | 3 + src/app/guards/app-authentication.guard.ts | 40 ++ src/app/models/login-session.ts | 12 + src/app/models/logout-session.ts | 7 + src/app/models/settings.ts | 22 ++ src/app/models/user-store.ts | 15 + src/app/pages/account/account.page.module.ts | 4 +- .../components/login.page.component.html | 4 +- .../components/login.page.component.ts | 7 +- .../account/account.section.module.ts | 16 + src/app/sections/account/components/index.ts | 3 + .../components/login.section.component.html | 1 + .../components/login.section.component.scss | 0 .../login.section.component.spec.ts | 32 ++ .../components/login.section.component.ts | 51 +++ .../services/app-authentication.service.ts | 136 +++++++ src/app/services/app-native.service.ts | 49 +++ src/app/store/authentication/actions.ts | 1 + src/app/store/authentication/effects.ts | 21 + src/app/store/authentication/reducers.ts | 4 + src/app/store/authentication/state.ts | 9 + src/app/store/effects.ts | 4 +- src/app/store/reducers.ts | 5 +- src/app/store/state.ts | 7 +- src/app/types/app-key.type.ts | 9 + src/environments/environment.hmr.ts | 102 ++++- src/environments/environment.prod.ts | 122 +++++- src/environments/environment.ts | 101 ++++- src/environments/environment.type.ts | 74 ++++ 32 files changed, 1180 insertions(+), 97 deletions(-) create mode 100644 src/app/guards/app-authentication.guard.ts create mode 100644 src/app/models/login-session.ts create mode 100644 src/app/models/logout-session.ts create mode 100644 src/app/models/settings.ts create mode 100644 src/app/models/user-store.ts create mode 100644 src/app/sections/account/account.section.module.ts create mode 100644 src/app/sections/account/components/index.ts create mode 100644 src/app/sections/account/components/login.section.component.html create mode 100644 src/app/sections/account/components/login.section.component.scss create mode 100644 src/app/sections/account/components/login.section.component.spec.ts create mode 100644 src/app/sections/account/components/login.section.component.ts create mode 100644 src/app/services/app-authentication.service.ts create mode 100644 src/app/services/app-native.service.ts create mode 100644 src/app/store/authentication/actions.ts create mode 100644 src/app/store/authentication/effects.ts create mode 100644 src/app/store/authentication/reducers.ts create mode 100644 src/app/store/authentication/state.ts create mode 100644 src/app/types/app-key.type.ts diff --git a/package-lock.json b/package-lock.json index 3163145..0ab62e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1695,89 +1695,186 @@ "requires": { "@ucap/core": "^0.0.1", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/api-common": { - "version": "0.0.1", - "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/api-common/-/api-common-0.0.1.tgz", - "integrity": "sha512-N7bbgZvvkCdM/80N09Xr1kUVK9S8xykX7dSbjaNjNkVAH+uNh18uhpfPu2jF5MlDQL9pUpdwwk8GG+WHVbQpVA==", + "version": "0.0.2", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/api-common/-/api-common-0.0.2.tgz", + "integrity": "sha512-yph9RMCY1iohzdtmk5rRRsckvGd5Xo8hn1LwsUTg5Bueu46YGvIglV7kokUE3M/0k0llTrg2lRjX14CtY9Ei8A==", "requires": { "@ucap/api": "^0.0.1", "@ucap/core": "^0.0.1", "axios": "^0.19.2", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/api-external": { - "version": "0.0.2", - "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/api-external/-/api-external-0.0.2.tgz", - "integrity": "sha512-G2LChDd+pJjRO8sMGYDt9eB0BP2bhBMotSvw7q920Q6pQjkJEygfHA/bZFpUhkAjTVdi6PMETg+gsSpVCl414A==", + "version": "0.0.4", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/api-external/-/api-external-0.0.4.tgz", + "integrity": "sha512-Po4UkLqoAiSMysM0QrXUsGOsaWiRfUN7gKUveu/eHSLhipVE1ydU7QusYle7aUMjoFmj6h7lg/ZkaYjDFlNqmQ==", "requires": { "@ucap/api": "^0.0.1", "@ucap/core": "^0.0.1", "axios": "^0.19.2", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/api-message": { - "version": "0.0.1", - "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/api-message/-/api-message-0.0.1.tgz", - "integrity": "sha512-NSuxuEp2e7po6lHtVLYPIH6jhMvBbytv401/ffi9UTuGhbft4lRdZ9y/jTTUtAD3QeoM5mdFz5D3c0ukc+qODA==", + "version": "0.0.2", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/api-message/-/api-message-0.0.2.tgz", + "integrity": "sha512-rV2KWnHw6p86ULyuaW/Un01nZNjWUWUB3zv48Q+6rpDNSH8RWUGJzNtfhPAxr9Rb7t7vsk3oBa40y+cAnOUJkQ==", "requires": { "@ucap/api": "^0.0.1", "@ucap/core": "^0.0.1", "axios": "^0.19.2", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/api-prompt": { - "version": "0.0.1", - "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/api-prompt/-/api-prompt-0.0.1.tgz", - "integrity": "sha512-Z7sezwGEZ8Vc6ZaRkbF/GdDFdbdFcVMGgIp822s03I8Klq5EINFc7mD9lIDyH3ddPqMOBeG+mvZxjAr/Bjhlyg==", + "version": "0.0.2", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/api-prompt/-/api-prompt-0.0.2.tgz", + "integrity": "sha512-Xc/S1uQT2ZHaXO403jUtPqVELexC5r9Qm+5LajhplzcC+eMuA2NrmS6FFgFjsQclQuCrqavJiJt+qLzqvPGqcg==", "requires": { "@ucap/api": "^0.0.1", "@ucap/core": "^0.0.1", "axios": "^0.19.2", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/api-public": { - "version": "0.0.1", - "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/api-public/-/api-public-0.0.1.tgz", - "integrity": "sha512-ezJlzeeKzBNl9rCry3Vz5hDBX8ECllanLC9Iqexx8th5+htKODMbw4EKB4jvqG1Y9xw+EPantbMWhcMshs4JIQ==", + "version": "0.0.2", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/api-public/-/api-public-0.0.2.tgz", + "integrity": "sha512-VnZkQWJs7OwbwPWzCqH9V9ma4HplWwJuPKIRs7D/pUIa4HIrkodpqMUKBTcb2mMzf6MSWSz7SJDdHksUGdhuRA==", "requires": { "@ucap/api": "^0.0.1", "@ucap/core": "^0.0.1", "axios": "^0.19.2", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/core": { - "version": "0.0.1", - "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", - "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "version": "0.0.2", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.2.tgz", + "integrity": "sha512-GqYS7R4hxPqwMzyBRYwpTyoLbqUg5Do3yj2Y7NhI9jkwlt1aLGWfN6WMOwUJzBHP+IGx4slhO1Pda7F+9OqBew==", "requires": { "detect-browser": "^5.0.0", "file-type": "^14.1.4" } }, "@ucap/native": { - "version": "0.0.1", - "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/native/-/native-0.0.1.tgz", - "integrity": "sha512-lvryFxk9luRqgsVVQwjFGnJl8JXseeoqnrqsUfG2AhOFGNioqQiLdhQZex3cxh4wr/+/t4pHPiMoOL0yVV/sdg==", + "version": "0.0.2", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/native/-/native-0.0.2.tgz", + "integrity": "sha512-kPF5tuWEeJ8QK5GGVOJK18ZIx2+surv3Crrf5rPXpdUWJgHA5BntCPWuYDz8M+nEVhjatdCrs9stqXNFJbtV0Q==", "requires": { "@ucap/core": "^0.0.1", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/native-browser": { - "version": "0.0.1", - "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/native-browser/-/native-browser-0.0.1.tgz", - "integrity": "sha512-4dXjItodiYp9fMISr0kSjSDwgL/0Y3HCZURkl7OJatVs3XBd2noed+OhNZiT7xYt7/OF6fY1UiN/0/0W3GgVnA==", + "version": "0.0.2", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/native-browser/-/native-browser-0.0.2.tgz", + "integrity": "sha512-yTvKwaTSe5+aP99oreYPT24r2QJcuBhM0q8goVW2cWUHbUKElMu+pWLZ18s10nCQ97yWs5D2naC4p34MC1KiMQ==", "requires": { "@ucap/core": "^0.0.1", "@ucap/native": "^0.0.1", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + }, + "@ucap/native": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/native/-/native-0.0.1.tgz", + "integrity": "sha512-lvryFxk9luRqgsVVQwjFGnJl8JXseeoqnrqsUfG2AhOFGNioqQiLdhQZex3cxh4wr/+/t4pHPiMoOL0yVV/sdg==", + "requires": { + "@ucap/core": "^0.0.1", + "rxjs": "^6.5.4" + } + } } }, "@ucap/ng-api-common": { @@ -1926,9 +2023,9 @@ "integrity": "sha512-S/uognL5t0N5yQSoLOKHnvE01158wmP10p70Swfues9o88Ct55ABFOggDFdNcrHd9K7ei6S+objl3hIq/kg42w==" }, "@ucap/ng-store-organization": { - "version": "0.0.2", - "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-store-organization/-/ng-store-organization-0.0.2.tgz", - "integrity": "sha512-cCCFQNvIG3FJEdxd8VkYvsKHM0tEL5ySKUvA5YS+5i0kksZJYvE2lgz7wD1rHqfg5ea57HnvrdHfFjukusJK0A==" + "version": "0.0.3", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-store-organization/-/ng-store-organization-0.0.3.tgz", + "integrity": "sha512-qakDmEzWloikSk/Sczs2i/dL54ZAIEqkjx2x4jcn0dMKkCF2KseCphNXTfaLpAcMuGVR5ZAy2bQjy90NbbHeOg==" }, "@ucap/ng-ui": { "version": "0.0.3", @@ -1951,15 +2048,26 @@ "integrity": "sha512-r74sXWxe6dHD/tiJ4VcWQ+oRD2yDbIFNJtsO7NyI/pMRILXyUX5qUDl53SEPL4m1vSFGXztIDyQ6DSi7UYcWCw==" }, "@ucap/pi": { - "version": "0.0.1", - "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/pi/-/pi-0.0.1.tgz", - "integrity": "sha512-IC+eh+AK4eemLLgvvn0O30qGjnCMTt3MHMjc+W1ykyZ3sCAYdZwqJTWM9YIhEJio/tE7Ayvvu8eMuchRW5Fc1w==", + "version": "0.0.2", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/pi/-/pi-0.0.2.tgz", + "integrity": "sha512-HgCuKMmdWMEhCi4zoPEOd/Ef+Fm7dRdI/66Jzyr2JRbbStAsrO9qIwXlmtTI40Ggy7nCrt1ywRAtV1m1pA2+Ug==", "requires": { "@ucap/api": "^0.0.1", "@ucap/core": "^0.0.1", "axios": "^0.19.2", "crypto-js": "^4.0.0", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/protocol": { @@ -1971,6 +2079,17 @@ "@ucap/web-socket": "^0.0.1", "queueing-subject": "^0.3.4", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/protocol-authentication": { @@ -1981,6 +2100,17 @@ "@ucap/core": "^0.0.1", "@ucap/protocol": "^0.0.1", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/protocol-buddy": { @@ -1991,6 +2121,17 @@ "@ucap/core": "^0.0.1", "@ucap/protocol": "^0.0.1", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/protocol-event": { @@ -2002,6 +2143,17 @@ "@ucap/core": "^0.0.1", "@ucap/protocol": "^0.0.1", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/protocol-file": { @@ -2013,6 +2165,17 @@ "@ucap/protocol": "^0.0.1", "@ucap/protocol-event": "^0.0.1", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/protocol-group": { @@ -2023,6 +2186,17 @@ "@ucap/core": "^0.0.1", "@ucap/protocol": "^0.0.1", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/protocol-info": { @@ -2034,6 +2208,17 @@ "@ucap/protocol": "^0.0.1", "@ucap/protocol-status": "^0.0.1", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/protocol-inner": { @@ -2044,16 +2229,38 @@ "@ucap/core": "^0.0.1", "@ucap/protocol": "^0.0.1", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/protocol-option": { - "version": "0.0.1", - "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-option/-/protocol-option-0.0.1.tgz", - "integrity": "sha512-7cM6qmvbpjmDoj4pL34PFXak3HNYBzIRy7yLtq6YNP3p8BiwfQqYJvsbIn1GzEScFk44vmXx2FC1WId6p2HnoQ==", + "version": "0.0.3", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-option/-/protocol-option-0.0.3.tgz", + "integrity": "sha512-eN3yxUDW4pcZf/nGfMbI0lnousWmvPkL5QhIP/lSgwOLZu3+hcWK5vMXr1bIUHHQyeUESzSCiMxB0CMjGOeJug==", "requires": { "@ucap/core": "^0.0.1", "@ucap/protocol": "^0.0.1", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/protocol-ping": { @@ -2064,6 +2271,17 @@ "@ucap/core": "^0.0.1", "@ucap/protocol": "^0.0.1", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/protocol-query": { @@ -2075,6 +2293,17 @@ "@ucap/protocol": "^0.0.1", "@ucap/protocol-authentication": "^0.0.1", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/protocol-room": { @@ -2087,6 +2316,17 @@ "@ucap/protocol-authentication": "^0.0.1", "@ucap/protocol-event": "^0.0.1", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/protocol-service": { @@ -2097,6 +2337,17 @@ "@ucap/core": "^0.0.1", "@ucap/protocol": "^0.0.1", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/protocol-status": { @@ -2107,6 +2358,17 @@ "@ucap/core": "^0.0.1", "@ucap/protocol": "^0.0.1", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/protocol-sync": { @@ -2120,6 +2382,17 @@ "@ucap/protocol-event": "^0.0.1", "@ucap/protocol-room": "^0.0.1", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/protocol-umg": { @@ -2130,6 +2403,17 @@ "@ucap/core": "^0.0.1", "@ucap/protocol": "^0.0.1", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@ucap/web-socket": { @@ -2148,6 +2432,17 @@ "@ucap/core": "^0.0.1", "crypto-js": "^4.0.0", "rxjs": "^6.5.4" + }, + "dependencies": { + "@ucap/core": { + "version": "0.0.1", + "resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.1.tgz", + "integrity": "sha512-TfQqgu9/Ys0a7wN+3U97ZivUcwF9Ko0uY3qWgyV41MzlCKjigH2L2+hxj6/x9yxXZIK6/ynvVW3RB7x1odR5bQ==", + "requires": { + "detect-browser": "^5.0.0", + "file-type": "^14.1.4" + } + } } }, "@webassemblyjs/ast": { diff --git a/package.json b/package.json index 8d7556a..d6379c5 100644 --- a/package.json +++ b/package.json @@ -29,14 +29,14 @@ "@ngrx/router-store": "^9.0.0", "@ngrx/store": "^9.0.0", "@ucap/api": "~0.0.1", - "@ucap/api-common": "~0.0.1", - "@ucap/api-external": "~0.0.2", - "@ucap/api-message": "~0.0.1", - "@ucap/api-prompt": "~0.0.1", - "@ucap/api-public": "~0.0.1", - "@ucap/core": "~0.0.1", - "@ucap/native": "~0.0.1", - "@ucap/native-browser": "~0.0.1", + "@ucap/api-common": "~0.0.2", + "@ucap/api-external": "~0.0.4", + "@ucap/api-message": "~0.0.2", + "@ucap/api-prompt": "~0.0.2", + "@ucap/api-public": "~0.0.2", + "@ucap/core": "~0.0.2", + "@ucap/native": "~0.0.2", + "@ucap/native-browser": "~0.0.2", "@ucap/ng-api-common": "~0.0.1", "@ucap/ng-api-external": "~0.0.1", "@ucap/ng-api-message": "~0.0.1", @@ -66,12 +66,12 @@ "@ucap/ng-store-authentication": "~0.0.2", "@ucap/ng-store-chat": "~0.0.3", "@ucap/ng-store-group": "~0.0.3", - "@ucap/ng-store-organization": "~0.0.2", + "@ucap/ng-store-organization": "~0.0.3", "@ucap/ng-web-storage": "~0.0.1", "@ucap/ng-ui": "~0.0.3", "@ucap/ng-ui-authentication": "~0.0.1", "@ucap/ng-ui-skin-default": "~0.0.1", - "@ucap/pi": "~0.0.1", + "@ucap/pi": "~0.0.2", "@ucap/protocol": "~0.0.1", "@ucap/protocol-authentication": "~0.0.1", "@ucap/protocol-buddy": "~0.0.1", @@ -80,7 +80,7 @@ "@ucap/protocol-group": "~0.0.1", "@ucap/protocol-info": "~0.0.1", "@ucap/protocol-inner": "~0.0.1", - "@ucap/protocol-option": "~0.0.1", + "@ucap/protocol-option": "~0.0.3", "@ucap/protocol-ping": "~0.0.1", "@ucap/protocol-query": "~0.0.1", "@ucap/protocol-room": "~0.0.1", diff --git a/src/app/app-provider.module.ts b/src/app/app-provider.module.ts index 2957c23..b5c1430 100644 --- a/src/app/app-provider.module.ts +++ b/src/app/app-provider.module.ts @@ -4,12 +4,25 @@ import axios from 'axios'; import { AxiosInstance } from 'axios'; import { AXIOS_INSTANCE } from '@ucap/ng-core'; +import { UCAP_NATIVE_SERVICE } from '@ucap/ng-native'; -export function axiosFactory() { - return (): AxiosInstance => { - return axios.create(); - }; -} +import { environment } from '@environments'; + +import { AppAuthenticationGuard } from './guards/app-authentication.guard'; + +import { AppAuthenticationService } from './services/app-authentication.service'; +import { AppNativeService } from './services/app-native.service'; + +const GUARDS = [AppAuthenticationGuard]; +const SERVICES = [AppAuthenticationService, AppNativeService]; + +const axiosFactory = () => { + const i = axios.create(); + + console.log('axios', i); + + return i; +}; @NgModule({ imports: [], @@ -20,7 +33,15 @@ export function axiosFactory() { useFactory: axiosFactory, deps: [], multi: false - } + }, + { + provide: UCAP_NATIVE_SERVICE, + useClass: environment.productConfig.nativeServiceClass, + deps: [AXIOS_INSTANCE], + multi: false + }, + ...GUARDS, + ...SERVICES ] }) export class AppProviderModule {} diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index dd3fe50..521d14c 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -4,6 +4,8 @@ import { Routes, RouterModule } from '@angular/router'; import { DefaultLayoutComponent } from '@app/layouts/components/default.layout.component'; import { NoNaviLayoutComponent } from '@app/layouts/components/no-navi.layout.component'; +import { AppAuthenticationGuard } from '@app/guards/app-authentication.guard'; + const routes: Routes = [ { path: 'account', @@ -24,6 +26,7 @@ const routes: Routes = [ { path: '', component: DefaultLayoutComponent, + canActivate: [AppAuthenticationGuard], children: [ { path: '', redirectTo: '/organization', pathMatch: 'full' }, { diff --git a/src/app/guards/app-authentication.guard.ts b/src/app/guards/app-authentication.guard.ts new file mode 100644 index 0000000..a98109a --- /dev/null +++ b/src/app/guards/app-authentication.guard.ts @@ -0,0 +1,40 @@ +import { Observable } from 'rxjs'; + +import { Injectable } from '@angular/core'; +import { + CanActivate, + ActivatedRouteSnapshot, + RouterStateSnapshot, + UrlTree, + Router +} from '@angular/router'; + +import { AppAuthenticationService } from '@app/services/app-authentication.service'; + +@Injectable({ + providedIn: 'root' +}) +export class AppAuthenticationGuard implements CanActivate { + constructor( + private appAuthenticationService: AppAuthenticationService, + private router: Router + ) {} + + canActivate( + route: ActivatedRouteSnapshot, + state: RouterStateSnapshot + ): + | boolean + | UrlTree + | Observable + | Promise { + return new Promise((resolve, reject) => { + if (this.appAuthenticationService.loggedIn()) { + resolve(true); + } else { + this.router.navigateByUrl('/account/login'); + resolve(false); + } + }); + } +} diff --git a/src/app/models/login-session.ts b/src/app/models/login-session.ts new file mode 100644 index 0000000..995080a --- /dev/null +++ b/src/app/models/login-session.ts @@ -0,0 +1,12 @@ +import { LocaleCode } from '@ucap/core'; + +export interface LoginSession { + loginId?: string; + loginPw?: string; + initPw?: boolean; + companyCode?: string; + companyGroupType?: string; + localeCode?: LocaleCode; + encData?: string; + deviceType?: string; +} diff --git a/src/app/models/logout-session.ts b/src/app/models/logout-session.ts new file mode 100644 index 0000000..90189b0 --- /dev/null +++ b/src/app/models/logout-session.ts @@ -0,0 +1,7 @@ +export interface LogoutSession { + loggedOut: boolean; + reasonCode?: number; + ip?: string; + mac?: string; + forceType?: string; +} diff --git a/src/app/models/settings.ts b/src/app/models/settings.ts new file mode 100644 index 0000000..ff9c0db --- /dev/null +++ b/src/app/models/settings.ts @@ -0,0 +1,22 @@ +import { + GeneralSetting as UCAPGeneralSetting, + NotificationSetting as UCAPNotificationSetting, + ChatSetting as UCAPChatSetting, + PresenceSetting as UCAPPresenceSetting +} from '@ucap/protocol-option'; + +// tslint:disable-next-line: no-empty-interface +export interface GeneralSetting extends UCAPGeneralSetting {} +// tslint:disable-next-line: no-empty-interface +export interface NotificationSetting extends UCAPNotificationSetting {} +// tslint:disable-next-line: no-empty-interface +export interface ChatSetting extends UCAPChatSetting {} +// tslint:disable-next-line: no-empty-interface +export interface PresenceSetting extends UCAPPresenceSetting {} + +export interface Settings { + general: GeneralSetting; + notification: NotificationSetting; + chat: ChatSetting; + presence: PresenceSetting; +} diff --git a/src/app/models/user-store.ts b/src/app/models/user-store.ts new file mode 100644 index 0000000..c0546b3 --- /dev/null +++ b/src/app/models/user-store.ts @@ -0,0 +1,15 @@ +import { LocaleCode } from '@ucap/core'; + +import { Settings } from './settings'; + +export interface UserStore { + loginId?: string; + loginPw?: string; + rememberMe?: boolean; + companyCode?: string; + companyGroupType?: string; + localeCode?: LocaleCode; + idleCheckTime?: number; + + settings?: Settings; +} diff --git a/src/app/pages/account/account.page.module.ts b/src/app/pages/account/account.page.module.ts index 2c089ec..16a5e9c 100644 --- a/src/app/pages/account/account.page.module.ts +++ b/src/app/pages/account/account.page.module.ts @@ -3,7 +3,7 @@ import { CommonModule } from '@angular/common'; import { FlexLayoutModule } from '@angular/flex-layout'; -import { AuthenticationUiModule } from '@ucap/ng-ui-authentication'; +import { AppAccountSectionModule } from '@app/sections/account/account.section.module'; import { AppAccountRoutingPageModule } from './account-routing.page.module'; @@ -13,7 +13,7 @@ import { COMPONENTS } from './components'; imports: [ CommonModule, FlexLayoutModule, - AuthenticationUiModule, + AppAccountSectionModule, AppAccountRoutingPageModule ], declarations: [...COMPONENTS], diff --git a/src/app/pages/account/components/login.page.component.html b/src/app/pages/account/components/login.page.component.html index 7b38e04..0c4b32c 100644 --- a/src/app/pages/account/components/login.page.component.html +++ b/src/app/pages/account/components/login.page.component.html @@ -1 +1,3 @@ - + diff --git a/src/app/pages/account/components/login.page.component.ts b/src/app/pages/account/components/login.page.component.ts index 978d251..1527bab 100644 --- a/src/app/pages/account/components/login.page.component.ts +++ b/src/app/pages/account/components/login.page.component.ts @@ -1,5 +1,6 @@ import { Component } from '@angular/core'; -import { CommonApiService } from '@ucap/ng-api-common'; + +import { environment } from '@environments'; @Component({ selector: 'app-pages-account-login', @@ -7,5 +8,7 @@ import { CommonApiService } from '@ucap/ng-api-common'; styleUrls: ['./login.page.component.scss'] }) export class LoginPageComponent { - constructor(private commonApiService: CommonApiService) {} + companyGroupCode = environment.companyConfig.companyGroupCode; + + constructor() {} } diff --git a/src/app/sections/account/account.section.module.ts b/src/app/sections/account/account.section.module.ts new file mode 100644 index 0000000..dc97db6 --- /dev/null +++ b/src/app/sections/account/account.section.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { FlexLayoutModule } from '@angular/flex-layout'; + +import { AuthenticationUiModule } from '@ucap/ng-ui-authentication'; + +import { COMPONENTS } from './components'; + +@NgModule({ + imports: [CommonModule, FlexLayoutModule, AuthenticationUiModule], + exports: [...COMPONENTS], + declarations: [...COMPONENTS], + entryComponents: [] +}) +export class AppAccountSectionModule {} diff --git a/src/app/sections/account/components/index.ts b/src/app/sections/account/components/index.ts new file mode 100644 index 0000000..139eb69 --- /dev/null +++ b/src/app/sections/account/components/index.ts @@ -0,0 +1,3 @@ +import { LoginSectionComponent } from './login.section.component'; + +export const COMPONENTS = [LoginSectionComponent]; diff --git a/src/app/sections/account/components/login.section.component.html b/src/app/sections/account/components/login.section.component.html new file mode 100644 index 0000000..7b38e04 --- /dev/null +++ b/src/app/sections/account/components/login.section.component.html @@ -0,0 +1 @@ + diff --git a/src/app/sections/account/components/login.section.component.scss b/src/app/sections/account/components/login.section.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/sections/account/components/login.section.component.spec.ts b/src/app/sections/account/components/login.section.component.spec.ts new file mode 100644 index 0000000..15a95af --- /dev/null +++ b/src/app/sections/account/components/login.section.component.spec.ts @@ -0,0 +1,32 @@ +import { TestBed, async } from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; +import { LoginSectionComponent } from './login.section.component'; + +describe('app::sections::account::LoginSectionComponent', () => { + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [RouterTestingModule], + declarations: [LoginSectionComponent] + }).compileComponents(); + })); + + it('should create the app', () => { + const fixture = TestBed.createComponent(LoginSectionComponent); + const app = fixture.componentInstance; + expect(app).toBeTruthy(); + }); + + it(`should have as title 'ucap-lg-web'`, () => { + const fixture = TestBed.createComponent(LoginSectionComponent); + const app = fixture.componentInstance; + }); + + it('should render title', () => { + const fixture = TestBed.createComponent(LoginSectionComponent); + fixture.detectChanges(); + const compiled = fixture.nativeElement; + expect(compiled.querySelector('.content span').textContent).toContain( + 'ucap-lg-web app is running!' + ); + }); +}); diff --git a/src/app/sections/account/components/login.section.component.ts b/src/app/sections/account/components/login.section.component.ts new file mode 100644 index 0000000..7532dcc --- /dev/null +++ b/src/app/sections/account/components/login.section.component.ts @@ -0,0 +1,51 @@ +import { Subscription } from 'rxjs'; + +import { Component, OnInit, OnDestroy, Input } from '@angular/core'; + +import { Store, select } from '@ngrx/store'; + +import { Company } from '@ucap/api-external'; + +import { ProtocolService } from '@ucap/ng-protocol'; + +import { CompanyActions, CompanySelector } from '@ucap/ng-store-organization'; + +@Component({ + selector: 'app-sections-account-login', + templateUrl: './login.section.component.html', + styleUrls: ['./login.section.component.scss'] +}) +export class LoginSectionComponent implements OnInit, OnDestroy { + @Input() + companyGroupCode: string; + + companyList: Company[]; + + private companyListSubscription: Subscription; + + constructor( + private protocolService: ProtocolService, + private store: Store + ) {} + ngOnInit(): void { + this.protocolService.disconnect(); + + this.store.dispatch( + CompanyActions.companies({ + req: { companyGroupCode: this.companyGroupCode } + }) + ); + + this.companyListSubscription = this.store + .pipe(select(CompanySelector.companyList)) + .subscribe(companyList => { + this.companyList = companyList; + }); + } + + ngOnDestroy(): void { + if (!!this.companyListSubscription) { + this.companyListSubscription.unsubscribe(); + } + } +} diff --git a/src/app/services/app-authentication.service.ts b/src/app/services/app-authentication.service.ts new file mode 100644 index 0000000..455e22d --- /dev/null +++ b/src/app/services/app-authentication.service.ts @@ -0,0 +1,136 @@ +import { Injectable, Inject } from '@angular/core'; + +import { LocaleCode } from '@ucap/core'; + +import { PasswordUtil } from '@ucap/pi'; + +import { + SessionStorageService, + LocalStorageService +} from '@ucap/ng-web-storage'; +import { NativeService } from '@ucap/native'; + +import { UCAP_NATIVE_SERVICE } from '@ucap/ng-native'; + +import { LoginSession } from '@app/models/login-session'; +import { UserStore } from '@app/models/user-store'; + +import { AppKey } from '@app/types/app-key.type'; + +import { environment } from '@environments'; + +@Injectable({ + providedIn: 'root' +}) +export class AppAuthenticationService { + constructor( + private sessionStorageService: SessionStorageService, + private localStorageService: LocalStorageService, + @Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService + ) {} + + loggedIn(): boolean { + const loginSession = this.sessionStorageService.get( + AppKey.LoginSession + ); + return null !== loginSession && !!loginSession.loginId; + } + + async login( + loginSession: LoginSession, + rememberMe: boolean, + autoLogin: boolean + ) { + loginSession = { ...loginSession, localeCode: LocaleCode.Korean }; + const encLoginPw = PasswordUtil.encrypt(loginSession.loginPw); + + this.sessionStorageService.set(AppKey.LoginSession, { + ...loginSession, + initPw: loginSession.loginId === loginSession.loginPw, + loginPw: encLoginPw + }); + + let userStore = this.localStorageService.encGet( + AppKey.UserStore, + environment.productConfig.localEncriptionKey + ); + + if (!userStore) { + userStore = { + idleCheckTime: 10, + settings: { + ...environment.productConfig.defaultSettings, + chat: { + ...environment.productConfig.defaultSettings.chat, + downloadPath: await this.nativeService.getPath( + 'documents', + environment.productConfig.file.defaultDownloadFolder + ) + } + } + }; + + if (!!environment.productConfig.defaultSettings.general.autoLaunch) { + this.nativeService.changeAutoLaunch( + environment.productConfig.defaultSettings.general.autoLaunch + ); + } + } + + userStore = { + ...userStore, + companyGroupType: loginSession.companyGroupType, + companyCode: loginSession.companyCode, + loginId: loginSession.loginId, + loginPw: loginSession.loginPw + }; + + if (rememberMe || autoLogin) { + userStore = { + ...userStore, + rememberMe + }; + userStore.settings.general.autoLogin = autoLogin; + } + + this.localStorageService.encSet( + AppKey.UserStore, + userStore, + environment.productConfig.localEncriptionKey + ); + + this.sessionStorageService.remove(AppKey.LogoutSession); + } + + logout() { + this.sessionStorageService.remove(AppKey.LoginResponse); + this.sessionStorageService.remove(AppKey.VerInfoResponse); + this.sessionStorageService.remove(AppKey.LoginSession); + this.sessionStorageService.remove(AppKey.UrlInfoResponse); + this.sessionStorageService.remove(AppKey.AuthResponse); + + let userStore = this.localStorageService.encGet( + AppKey.UserStore, + environment.productConfig.localEncriptionKey + ); + + if (!!userStore) { + userStore = { + ...userStore, + settings: { + ...userStore.settings, + general: { + ...userStore.settings.general, + autoLogin: false + } + } + }; + + this.localStorageService.encSet( + AppKey.UserStore, + userStore, + environment.productConfig.localEncriptionKey + ); + } + } +} diff --git a/src/app/services/app-native.service.ts b/src/app/services/app-native.service.ts new file mode 100644 index 0000000..07b5831 --- /dev/null +++ b/src/app/services/app-native.service.ts @@ -0,0 +1,49 @@ +import { Injectable, Inject, NgZone } from '@angular/core'; + +import { MatDialog } from '@angular/material/dialog'; + +import { Store } from '@ngrx/store'; + +import { LoginResponse } from '@ucap/protocol-authentication'; + +import { NativeService } from '@ucap/native'; + +import { UCAP_NATIVE_SERVICE } from '@ucap/ng-native'; +import { SessionStorageService } from '@ucap/ng-web-storage'; + +import { AppKey } from '@app/types/app-key.type'; + +@Injectable({ + providedIn: 'root' +}) +export class AppNativeService { + constructor( + @Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService, + private sessionStorageService: SessionStorageService, + private store: Store, + private matDialog: MatDialog, + private ngZone: NgZone + ) {} + + subscribe(): void { + this.nativeService.logout().subscribe(() => { + this.ngZone.run(() => { + this.matDialog.closeAll(); + + const loginRes = this.sessionStorageService.get( + AppKey.LoginResponse + ); + + // this.store.dispatch(AuthenticationActions.logoutConfirmation()); + }); + }); + + this.nativeService.changeStatus().subscribe(statusCode => {}); + + this.nativeService.showSetting().subscribe(() => { + this.ngZone.run(() => { + // this.store.dispatch(SettingsStore.showDialog()); + }); + }); + } +} diff --git a/src/app/store/authentication/actions.ts b/src/app/store/authentication/actions.ts new file mode 100644 index 0000000..a1ff6e7 --- /dev/null +++ b/src/app/store/authentication/actions.ts @@ -0,0 +1 @@ +import { createAction } from '@ngrx/store'; diff --git a/src/app/store/authentication/effects.ts b/src/app/store/authentication/effects.ts new file mode 100644 index 0000000..dacf263 --- /dev/null +++ b/src/app/store/authentication/effects.ts @@ -0,0 +1,21 @@ +import { map, exhaustMap } from 'rxjs/operators'; + +import { Injectable } from '@angular/core'; + +import { Actions, createEffect, ofType } from '@ngrx/effects'; + +import { LoginResponse } from '@ucap/protocol-authentication'; + +import { SessionStorageService } from '@ucap/ng-web-storage'; + +import { LoginActions } from '@ucap/ng-store-authentication'; + +import { AppKey } from '@app/types/app-key.type'; + +@Injectable() +export class Effects { + constructor( + private actions$: Actions, + private sessionStorageService: SessionStorageService + ) {} +} diff --git a/src/app/store/authentication/reducers.ts b/src/app/store/authentication/reducers.ts new file mode 100644 index 0000000..70e7e20 --- /dev/null +++ b/src/app/store/authentication/reducers.ts @@ -0,0 +1,4 @@ +import { createReducer, on } from '@ngrx/store'; +import { initialState } from './state'; + +export const reducer = createReducer(initialState); diff --git a/src/app/store/authentication/state.ts b/src/app/store/authentication/state.ts new file mode 100644 index 0000000..1e05bd0 --- /dev/null +++ b/src/app/store/authentication/state.ts @@ -0,0 +1,9 @@ +import { Selector, createSelector } from '@ngrx/store'; + +export interface State {} + +export const initialState: State = {}; + +export function selectors(selector: Selector) { + return {}; +} diff --git a/src/app/store/effects.ts b/src/app/store/effects.ts index fdc5656..d087ede 100644 --- a/src/app/store/effects.ts +++ b/src/app/store/effects.ts @@ -1,3 +1,5 @@ import { Type } from '@angular/core'; -export const effects: Type[] = []; +import { Effects as AuthenticationEffects } from './authentication/effects'; + +export const effects: Type[] = [AuthenticationEffects]; diff --git a/src/app/store/reducers.ts b/src/app/store/reducers.ts index 6c9fc94..0a0f026 100644 --- a/src/app/store/reducers.ts +++ b/src/app/store/reducers.ts @@ -5,10 +5,13 @@ import * as fromRouter from '@ngrx/router-store'; import { State } from './state'; +import { reducer as authenticationReducer } from './authentication/reducers'; + export const ROOT_REDUCERS = new InjectionToken< ActionReducerMap >('Root reducers token', { factory: () => ({ - router: fromRouter.routerReducer + appRouter: fromRouter.routerReducer, + appAuthentication: authenticationReducer }) }); diff --git a/src/app/store/state.ts b/src/app/store/state.ts index 155826c..f39e4ae 100644 --- a/src/app/store/state.ts +++ b/src/app/store/state.ts @@ -6,10 +6,13 @@ import { import * as fromRouter from '@ngrx/router-store'; -import { environment } from '../../environments/environment'; +import { environment } from '@environments'; + +import { State as AuthenticationState } from './authentication/state'; export interface State { - router: fromRouter.RouterReducerState; + appRouter: fromRouter.RouterReducerState; + appAuthentication: AuthenticationState; } export const metaReducers: MetaReducer[] = !environment.production diff --git a/src/app/types/app-key.type.ts b/src/app/types/app-key.type.ts new file mode 100644 index 0000000..7027698 --- /dev/null +++ b/src/app/types/app-key.type.ts @@ -0,0 +1,9 @@ +export enum AppKey { + LoginSession = 'ucap::LG::LOGIN_SESSION', + LogoutSession = 'ucap::LG::LOGOUT_SESSION', + UserStore = 'ucap::LG::USER_STORE', + LoginResponse = 'ucap::LG::LOGIN_RESPONSE', + AuthResponse = 'ucap::LG::AUTH_RESPONSE', + UrlInfoResponse = 'ucap::LG::URL_INFO_RESPONSE', + VerInfoResponse = 'ucap::LG::VER_INFO_RESPONSE' +} diff --git a/src/environments/environment.hmr.ts b/src/environments/environment.hmr.ts index 1214338..b9355e7 100644 --- a/src/environments/environment.hmr.ts +++ b/src/environments/environment.hmr.ts @@ -1,3 +1,7 @@ +import { DeviceType, DesktopType, NotificationMethod } from '@ucap/core'; + +import { BrowserNativeService } from '@ucap/ng-native-browser'; + import { Environment, commonApiUrls, @@ -16,11 +20,91 @@ export const environment: Environment = { production: false, hmr: true, + productConfig: { + productId: 'PRO_000482', + productName: 'EZMessenger', + localEncriptionKey: '!@#$LG%^&*', + nativeServiceClass: BrowserNativeService, + updateCheck: { + deviceType: DeviceType.Renderer, + devicePlatformType: DesktopType.Windows, + intervalHour: 1 + }, + defaultSettings: { + general: { + theme: 'theme-default', + autoLogin: false, + autoLaunch: false, + continueRunWhenClose: true, + locale: 'ko', + hrInfoLocale: 'ko', + startupHideWindow: false, + timezone: 'Asia/Seoul' + }, + notification: { + preView: true, + use: true, + method: NotificationMethod.SoundAndAlert, + alertExposureTime: 5, + receiveForMobile: false, + receiveForMessage: false + }, + chat: { + fontFamily: 'Malgun Gothic', + fontSize: 12, + downloadPath: undefined + }, + presence: { + absenceTime: 10 + } + }, + file: { + defaultDownloadFolder: 'LF Talk2 Download', + defaultFileAllowSize: 100 + }, + authentication: { + usePrivateInformationAgree: false, + rememberMe: { + use: false + }, + autoLogin: { + use: true + } + }, + profile: { + editableProfileImage: false + }, + group: { + useMyDeptGroup: false, + myDeptGroupSeq: -5, + fixedGroupSeqs: [-5] + }, + chat: { + useTimerRoom: false, + timerRoomDefaultInterval: 24 * 60 * 60, + + maxChatRoomUser: 300, + masstextLength: 800, + + eventRequestInitCount: 30, + eventRequestDefaultCount: 50, + + readHereShowMinimumEventCount: 10, + readHereShowMaximumEventCount: 100, + readHereEventRequestCount: 10 + } + }, + + companyConfig: { + companyGroupCode: 'LG', + fixedCompanyCode: 'LF' + }, + commonApiModuleConfig: { hostConfig: { protocol: 'http', - domain: '15.164.139.105', - port: 8011 + domain: '121.50.21.57', + port: 8033 }, urls: commonApiUrls, acceptableFileExtensions: commonApiacceptableFileExtensions, @@ -31,8 +115,8 @@ export const environment: Environment = { publicApiModuleConfig: { hostConfig: { protocol: 'http', - domain: '15.164.139.105', - port: 8011 + domain: '121.50.21.57', + port: 8033 }, urls: publicApiUrls }, @@ -40,7 +124,7 @@ export const environment: Environment = { externalApiModuleConfig: { hostConfig: { protocol: 'http', - domain: '15.164.139.105', + domain: '121.50.21.57', port: 8011 }, urls: externalApiUrls @@ -49,7 +133,7 @@ export const environment: Environment = { messageApiModuleConfig: { hostConfig: { protocol: 'http', - domain: '15.164.139.105', + domain: '121.50.21.57', port: 9097 }, urls: messageApiUrls @@ -58,7 +142,7 @@ export const environment: Environment = { promptApiModuleConfig: { hostConfig: { protocol: 'http', - domain: '15.164.139.105', + domain: '121.50.21.57', port: 9097 }, urls: promptUrls @@ -67,7 +151,7 @@ export const environment: Environment = { piModuleConfig: { hostConfig: { protocol: 'http', - domain: '15.164.139.105', + domain: '121.50.21.57', port: 9097 }, urls: piUrls @@ -76,7 +160,7 @@ export const environment: Environment = { protocolModuleConfig: { hostConfig: { protocol: 'ws', - domain: '15.164.139.105', + domain: '121.50.21.57', port: 8080 }, urls: protocolUrls, diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 2040361..a438d8a 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,3 +1,6 @@ +import { DeviceType, DesktopType, NotificationMethod } from '@ucap/core'; +import { BrowserNativeService } from '@ucap/ng-native-browser'; + import { Environment, commonApiUrls, @@ -11,17 +14,96 @@ import { commonApiAcceptableFileExtensionsForImage, commonApiAcceptableFileExtensionsForVideo } from './environment.type'; -import { HostProtocol } from '@ucap/core'; -export const environment = { - production: true, +export const environment: Environment = { + production: false, hmr: false, + productConfig: { + productId: 'PRO_000482', + productName: 'EZMessenger', + localEncriptionKey: '!@#$LG%^&*', + nativeServiceClass: BrowserNativeService, + updateCheck: { + deviceType: DeviceType.Renderer, + devicePlatformType: DesktopType.Windows, + intervalHour: 1 + }, + defaultSettings: { + general: { + theme: 'theme-default', + autoLogin: false, + autoLaunch: false, + continueRunWhenClose: true, + locale: 'ko', + hrInfoLocale: 'ko', + startupHideWindow: false, + timezone: 'Asia/Seoul' + }, + notification: { + preView: true, + use: true, + method: NotificationMethod.SoundAndAlert, + alertExposureTime: 5, + receiveForMobile: false, + receiveForMessage: false + }, + chat: { + fontFamily: 'Malgun Gothic', + fontSize: 12, + downloadPath: undefined + }, + presence: { + absenceTime: 10 + } + }, + file: { + defaultDownloadFolder: 'LF Talk2 Download', + defaultFileAllowSize: 100 + }, + authentication: { + usePrivateInformationAgree: false, + rememberMe: { + use: false + }, + autoLogin: { + use: true + } + }, + profile: { + editableProfileImage: false + }, + group: { + useMyDeptGroup: false, + myDeptGroupSeq: -5, + fixedGroupSeqs: [-5] + }, + chat: { + useTimerRoom: false, + timerRoomDefaultInterval: 24 * 60 * 60, + + maxChatRoomUser: 300, + masstextLength: 800, + + eventRequestInitCount: 30, + eventRequestDefaultCount: 50, + + readHereShowMinimumEventCount: 10, + readHereShowMaximumEventCount: 100, + readHereEventRequestCount: 10 + } + }, + + companyConfig: { + companyGroupCode: 'LG', + fixedCompanyCode: 'LF' + }, + commonApiModuleConfig: { hostConfig: { - protocol: 'https' as HostProtocol, - domain: 'dstalk.daesang.com', - port: 443 + protocol: 'http', + domain: 'lftalk2.lfcorp.com', + port: 8033 }, urls: commonApiUrls, acceptableFileExtensions: commonApiacceptableFileExtensions, @@ -31,26 +113,26 @@ export const environment = { publicApiModuleConfig: { hostConfig: { - protocol: 'https' as HostProtocol, - domain: 'dstalk.daesang.com', - port: 443 + protocol: 'http', + domain: 'lftalk2.lfcorp.com', + port: 8033 }, urls: publicApiUrls }, externalApiModuleConfig: { hostConfig: { - protocol: 'https' as HostProtocol, - domain: 'dstalk.daesang.com', - port: 443 + protocol: 'http', + domain: 'lftalk2.lfcorp.com', + port: 8011 }, urls: externalApiUrls }, messageApiModuleConfig: { hostConfig: { - protocol: 'https' as HostProtocol, - domain: 'dstalk.daesang.com', + protocol: 'http', + domain: 'lftalk2.lfcorp.com', port: 9097 }, urls: messageApiUrls @@ -58,8 +140,8 @@ export const environment = { promptApiModuleConfig: { hostConfig: { - protocol: 'https' as HostProtocol, - domain: 'dstalk.daesang.com', + protocol: 'http', + domain: 'lftalk2.lfcorp.com', port: 9097 }, urls: promptUrls @@ -67,8 +149,8 @@ export const environment = { piModuleConfig: { hostConfig: { - protocol: 'https' as HostProtocol, - domain: 'dstalk.daesang.com', + protocol: 'http', + domain: 'lftalk2.lfcorp.com', port: 9097 }, urls: piUrls @@ -76,8 +158,8 @@ export const environment = { protocolModuleConfig: { hostConfig: { - protocol: 'ws' as HostProtocol, - domain: 'messenger2.daesang.com', + protocol: 'ws', + domain: 'lftalk2.lfcorp.com', port: 8080 }, urls: protocolUrls, diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 4e0155a..06a4005 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -1,6 +1,9 @@ // This file can be replaced during build by using the `fileReplacements` array. // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. // The list of file replacements can be found in `angular.json`. +import { DeviceType, DesktopType, NotificationMethod } from '@ucap/core'; +import { BrowserNativeService } from '@ucap/ng-native-browser'; + import { Environment, commonApiUrls, @@ -19,11 +22,91 @@ export const environment: Environment = { production: false, hmr: false, + productConfig: { + productId: 'PRO_000482', + productName: 'EZMessenger', + localEncriptionKey: '!@#$LG%^&*', + nativeServiceClass: BrowserNativeService, + updateCheck: { + deviceType: DeviceType.Renderer, + devicePlatformType: DesktopType.Windows, + intervalHour: 1 + }, + defaultSettings: { + general: { + theme: 'theme-default', + autoLogin: false, + autoLaunch: false, + continueRunWhenClose: true, + locale: 'ko', + hrInfoLocale: 'ko', + startupHideWindow: false, + timezone: 'Asia/Seoul' + }, + notification: { + preView: true, + use: true, + method: NotificationMethod.SoundAndAlert, + alertExposureTime: 5, + receiveForMobile: false, + receiveForMessage: false + }, + chat: { + fontFamily: 'Malgun Gothic', + fontSize: 12, + downloadPath: undefined + }, + presence: { + absenceTime: 10 + } + }, + file: { + defaultDownloadFolder: 'LF Talk2 Download', + defaultFileAllowSize: 100 + }, + authentication: { + usePrivateInformationAgree: false, + rememberMe: { + use: false + }, + autoLogin: { + use: true + } + }, + profile: { + editableProfileImage: false + }, + group: { + useMyDeptGroup: false, + myDeptGroupSeq: -5, + fixedGroupSeqs: [-5] + }, + chat: { + useTimerRoom: false, + timerRoomDefaultInterval: 24 * 60 * 60, + + maxChatRoomUser: 300, + masstextLength: 800, + + eventRequestInitCount: 30, + eventRequestDefaultCount: 50, + + readHereShowMinimumEventCount: 10, + readHereShowMaximumEventCount: 100, + readHereEventRequestCount: 10 + } + }, + + companyConfig: { + companyGroupCode: 'LG', + fixedCompanyCode: 'LF' + }, + commonApiModuleConfig: { hostConfig: { protocol: 'http', - domain: '15.164.139.105', - port: 8011 + domain: '13.124.88.127', + port: 8033 }, urls: commonApiUrls, acceptableFileExtensions: commonApiacceptableFileExtensions, @@ -34,8 +117,8 @@ export const environment: Environment = { publicApiModuleConfig: { hostConfig: { protocol: 'http', - domain: '15.164.139.105', - port: 8011 + domain: '13.124.88.127', + port: 8033 }, urls: publicApiUrls }, @@ -43,7 +126,7 @@ export const environment: Environment = { externalApiModuleConfig: { hostConfig: { protocol: 'http', - domain: '15.164.139.105', + domain: '13.124.88.127', port: 8011 }, urls: externalApiUrls @@ -52,7 +135,7 @@ export const environment: Environment = { messageApiModuleConfig: { hostConfig: { protocol: 'http', - domain: '15.164.139.105', + domain: '13.124.88.127', port: 9097 }, urls: messageApiUrls @@ -61,7 +144,7 @@ export const environment: Environment = { promptApiModuleConfig: { hostConfig: { protocol: 'http', - domain: '15.164.139.105', + domain: '13.124.88.127', port: 9097 }, urls: promptUrls @@ -70,7 +153,7 @@ export const environment: Environment = { piModuleConfig: { hostConfig: { protocol: 'http', - domain: '15.164.139.105', + domain: '13.124.88.127', port: 9097 }, urls: piUrls @@ -79,7 +162,7 @@ export const environment: Environment = { protocolModuleConfig: { hostConfig: { protocol: 'ws', - domain: '15.164.139.105', + domain: '13.124.88.127', port: 8080 }, urls: protocolUrls, diff --git a/src/environments/environment.type.ts b/src/environments/environment.type.ts index ea9b187..06aa0af 100644 --- a/src/environments/environment.type.ts +++ b/src/environments/environment.type.ts @@ -1,3 +1,7 @@ +import { Type } from '@angular/core'; + +import { DeviceType, DesktopType } from '@ucap/core'; + import { ModuleConfig as CommonApiModuleConfig, Urls as CommonApiUrls @@ -30,10 +34,80 @@ import { Urls as ProtocolUrls } from '@ucap/protocol'; +import { Settings } from '@app/models/settings'; + export interface Environment { production: boolean; hmr: boolean; + productConfig: { + productId: string; + productName: string; + localEncriptionKey: string; + nativeServiceClass: Type; + updateCheck: { + deviceType: DeviceType; + devicePlatformType: DesktopType; + intervalHour: number; + }; + defaultSettings: Settings; + file: { + /** 기본 다운로드 경로 */ + defaultDownloadFolder: string; + /** 파일업로드 제한 사이즈 (mb) */ + defaultFileAllowSize: number; + }; + authentication: { + usePrivateInformationAgree: boolean; + rememberMe: { + use: boolean; + }; + autoLogin: { + use: boolean; + }; + }; + profile: { + /** 내 프로필 이미지 수정 가능 여부 */ + editableProfileImage: boolean; + }; + group: { + /** 소속부서(내부서) 그룹핑 사용여부 */ + useMyDeptGroup: boolean; + /** 소속부서(내부서) 고정 그룹 SEQ */ + myDeptGroupSeq: number; + /** 삭제,수정 불가 그룹 Seqs:number[] */ + fixedGroupSeqs: number[]; + }; + chat: { + /** 타이머대화방 사용유무 */ + useTimerRoom: boolean; + /** 타이머대화방 기본 interval */ + timerRoomDefaultInterval: number; + + /** 최대 대화방 참여인원 */ + maxChatRoomUser: number; + /** 대용량대화 기준 */ + masstextLength: number; + + /** 대화방 초기 로딩 이벤트 갯수 */ + eventRequestInitCount: number; + /** 대화방 이벤트 조회 개수 */ + eventRequestDefaultCount: number; + + /** 여기까지 읽음을 보여줄 최소 이벤트 개수 (show: over) */ + readHereShowMinimumEventCount: number; + /** 여기까지 읽음을 보여줄 최대 이벤트 개수 (show: under) */ + readHereShowMaximumEventCount: number; + /** 여기까지 읽음이 보여질때 대화방 이벤트 조회 개수. */ + readHereEventRequestCount: number; + }; + }; + + companyConfig: { + companyGroupCode: string; + fixedCompanyCode: string; + }; + commonApiModuleConfig: CommonApiModuleConfig; publicApiModuleConfig: PublicApiModuleConfig; externalApiModuleConfig: ExternalApiModuleConfig;