bug fixed
This commit is contained in:
parent
aa4bcf9c43
commit
1400048991
83
package-lock.json
generated
83
package-lock.json
generated
|
@ -1771,9 +1771,9 @@
|
|||
"integrity": "sha512-FDg7WLiq5Y5aPxC66LXKQOnqily1zcaUdtl3ZMGU3HfENod/d6aFarqFZOw5y0C+OZQ1LB+jIKa+AP0V4zC0Ug=="
|
||||
},
|
||||
"@ucap/core": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.4.tgz",
|
||||
"integrity": "sha512-pghZ8oC0IKuD3c/ztAbkUFWaJMHyjRNtWKhOcOl6hFr9ttvmzAZNfXfOm5Wp30ROOXWDITYrjVQ4OC/vte7GHg=="
|
||||
"version": "0.0.5",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/core/-/core-0.0.5.tgz",
|
||||
"integrity": "sha512-Qg9Sgm1go7VCTtHCt8ihUeMxzZSIx2ZvhAE/XRKlHCOUm5hMUlIEvpp5gDPmlN+LBg+DtgZul7fi9G7iGiB7sA=="
|
||||
},
|
||||
"@ucap/logger": {
|
||||
"version": "0.0.7",
|
||||
|
@ -1951,9 +1951,14 @@
|
|||
"integrity": "sha512-U/tpzUgXSGrWzetmmqEcLYYzgCUEew3C0CcfYSr+ajkt4AvHqcFijqXARVHXVahfAkMXZU69/8etDhzWmOcvGw=="
|
||||
},
|
||||
"@ucap/ng-ui-authentication": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-ui-authentication/-/ng-ui-authentication-0.0.8.tgz",
|
||||
"integrity": "sha512-n6pV113DuSD5TV4jAwrY/JJlhcBtNLHEFTTxrQ8QhFIMz9hgbRC6x4R/LF8q9kzx0BWQcgxGdfgY1oN3YoqGtg=="
|
||||
"version": "0.0.14",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-ui-authentication/-/ng-ui-authentication-0.0.14.tgz",
|
||||
"integrity": "sha512-wejkhebthEUub9nGigu9/fENB7hwOHrYTDq4dPmitxKeb3o1RNdbjAzaEB0QlVmLF+/ReydWZqr2d4d8Dus+/g=="
|
||||
},
|
||||
"@ucap/ng-ui-organization": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/ng-ui-organization/-/ng-ui-organization-0.0.2.tgz",
|
||||
"integrity": "sha512-xywle2jhGaaNxkH+9VLvIOxfFzdLMf5nGP7fqW9gPSZiK51OR5s81UwWoXCeQRfnJuUX+6U97LoY7KAO5c0LLA=="
|
||||
},
|
||||
"@ucap/ng-ui-skin-default": {
|
||||
"version": "0.0.1",
|
||||
|
@ -1966,29 +1971,29 @@
|
|||
"integrity": "sha512-r74sXWxe6dHD/tiJ4VcWQ+oRD2yDbIFNJtsO7NyI/pMRILXyUX5qUDl53SEPL4m1vSFGXztIDyQ6DSi7UYcWCw=="
|
||||
},
|
||||
"@ucap/pi": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/pi/-/pi-0.0.4.tgz",
|
||||
"integrity": "sha512-faQQ8cV3GFChN84yUwfWq/KL2WKT0QaNS8hsVI9qWRXSqRaIkA9AGxZM9u/YhUB1NGMIQDz6hyJ/iD9B9l8JFA=="
|
||||
"version": "0.0.5",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/pi/-/pi-0.0.5.tgz",
|
||||
"integrity": "sha512-nWev387pHxeBHtOu0EvRTVQ0/JeJL44Ew0PzQaiqHsC5mghkJ6ok7z22nk9nmuZ7lONxGJmW7CHT8X8lyviZJg=="
|
||||
},
|
||||
"@ucap/protocol": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol/-/protocol-0.0.2.tgz",
|
||||
"integrity": "sha512-+lk492tb+vXeXJfINiW63Po9gytuA9EZwriZiYApHhLG0DeTUnL/FjWMspGNG7vHlhp2kld3zJlThZ45jz/YQQ=="
|
||||
"version": "0.0.4",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol/-/protocol-0.0.4.tgz",
|
||||
"integrity": "sha512-ChkRjoJQqfwVj6Itv/OnI3jtFUP8W/5b6kVLgyq1cOITdxata3/nH9NB2DFFxSpKs4fVTulMvJ/qOBSY2jku0Q=="
|
||||
},
|
||||
"@ucap/protocol-authentication": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-authentication/-/protocol-authentication-0.0.2.tgz",
|
||||
"integrity": "sha512-DSnoPvWAfLLWb8WMfCX72vJHvNrj5GKM90p6mo8GUML1F9s440ovaSpNmiLkq32TPhJeFvGI6R8oqdQzI1lASg=="
|
||||
"version": "0.0.3",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-authentication/-/protocol-authentication-0.0.3.tgz",
|
||||
"integrity": "sha512-/rqlHbqZr5phu5ytwviBntw240Ia/99tS4GCY4eMHj8GCWzH3qAayRFS+PSYK/3DfD+Wx6sTCwtE4yVIo/b9pw=="
|
||||
},
|
||||
"@ucap/protocol-buddy": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-buddy/-/protocol-buddy-0.0.2.tgz",
|
||||
"integrity": "sha512-HvwU2DCGrloB0U3jnGqfORmCu+j/sV/4VsAZooCX6kTzP8r+SF2PvgSLm87KzMhCV3BjOR7vhwl/bu7CDh75iQ=="
|
||||
"version": "0.0.3",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-buddy/-/protocol-buddy-0.0.3.tgz",
|
||||
"integrity": "sha512-Nn86QUXUDF6R8kiV5DqbRoiBgEb0sVn5FuslZNbNcG3hNLmu3EtPuxeHDDwyNaojiBC4tCHB/SyJyL6V7VTAqA=="
|
||||
},
|
||||
"@ucap/protocol-event": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-event/-/protocol-event-0.0.2.tgz",
|
||||
"integrity": "sha512-qEVyzf0aMm0yVqhLlLOjD9WgfAo+BMtxtyGc4oFSjIMhUPLxiX0DQ5r5f+SH2YDYUjKZD37NjhXbq3CCSeXfTA=="
|
||||
"version": "0.0.3",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-event/-/protocol-event-0.0.3.tgz",
|
||||
"integrity": "sha512-9vEIpbgJk1yCkXPNJn/d2zxcIfNuZXTG3wOwNE7tBgPabQ3zmWn2Mgn6n8pDIPiY8HynHwx5Xe6Cyl6kMZQREA=="
|
||||
},
|
||||
"@ucap/protocol-file": {
|
||||
"version": "0.0.2",
|
||||
|
@ -1996,14 +2001,14 @@
|
|||
"integrity": "sha512-/uLPgJBe4Upu/hkiUCXJb1x0/QtTUaxMfm/6tSdErZsFgUB0rlBKEO87N+waM1PwFGARbIBIvdT5E1Q9Tn7jUA=="
|
||||
},
|
||||
"@ucap/protocol-group": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-group/-/protocol-group-0.0.2.tgz",
|
||||
"integrity": "sha512-ZkUA9mEphYwsRjuwQ7bQZ7e+suSi+wiLG+NMwj8fwhCoEUkxASBuSgYKIo2RyuMgew8Oei535t6UpokGYKTS+A=="
|
||||
"version": "0.0.3",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-group/-/protocol-group-0.0.3.tgz",
|
||||
"integrity": "sha512-40iDldQy99bwbcOKAxHZjcK4SJku7V2x8vEQx1unWdb34VvOSl7YmS1/PzK3UWl799G3pYVVh9cDYmI16Q6zsQ=="
|
||||
},
|
||||
"@ucap/protocol-info": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-info/-/protocol-info-0.0.2.tgz",
|
||||
"integrity": "sha512-yonCF0rFtfwQYk7pPtcGHo/hhXe9xuxdGFoBd8iGDJSxNJDr4s/j/dsLTCiyWRTS/H9K+8A2cABCrfpGn0KVTA=="
|
||||
"version": "0.0.3",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-info/-/protocol-info-0.0.3.tgz",
|
||||
"integrity": "sha512-q1csFIShCYcKjplswr65jZcV8R/ktD13SS5TLMgFbMz4zBpyk2QSPcgI0e3ts7jHOz0bG14Iw7j1Lc9G+xlRUA=="
|
||||
},
|
||||
"@ucap/protocol-inner": {
|
||||
"version": "0.0.2",
|
||||
|
@ -2026,9 +2031,9 @@
|
|||
"integrity": "sha512-xfzEFchd9FYPbj21UtZo0WwS+LhDPTwSaCnWQHGRtFg3waDAgaEjKRhaCNlUuxXhHWuSnKBHUS50HsQTojUArQ=="
|
||||
},
|
||||
"@ucap/protocol-room": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-room/-/protocol-room-0.0.2.tgz",
|
||||
"integrity": "sha512-wb381vwN8G6WYs/qwN+8HrsmVwwGfH8bJ4P+zndHx39KUtAiOHn90k60FE7l7Fz0gvrN/WAzgwTD6UbdbdvkxA=="
|
||||
"version": "0.0.3",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-room/-/protocol-room-0.0.3.tgz",
|
||||
"integrity": "sha512-+f7dpBbMflrcXTGVVhOH62GFa/H08mXqxj8AXRJ2n7pCmb+v5f4+mfmCu1vCTuBfwObisXeARlOhWaVIJpMXzw=="
|
||||
},
|
||||
"@ucap/protocol-service": {
|
||||
"version": "0.0.2",
|
||||
|
@ -2036,9 +2041,9 @@
|
|||
"integrity": "sha512-KUI5RBeJ3Wfkvw4P0Mxg9hc6FRyQi0CgVl1fkVV0POiVg38VyLBDROjF4PWJ9OpPbd1UF/azWvcm/04XqBryjg=="
|
||||
},
|
||||
"@ucap/protocol-status": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-status/-/protocol-status-0.0.2.tgz",
|
||||
"integrity": "sha512-h8Kw+aZkwbHmf/Xknz3//f0RqZYTOmVr98mfLAhW5EHQDR9Lf0YZXIUAsIvHQ1NPI3nEK5/SJnOPDesZKwqLmw=="
|
||||
"version": "0.0.3",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-status/-/protocol-status-0.0.3.tgz",
|
||||
"integrity": "sha512-PmepRcuLEqNqA0N3068bxTsEdk1xL8NaE54rBONiGwRhQQfFXDKMpao+dJAAJpKMpTf5NzlvlLuT2x2eh6IBnA=="
|
||||
},
|
||||
"@ucap/protocol-sync": {
|
||||
"version": "0.0.2",
|
||||
|
@ -2046,9 +2051,9 @@
|
|||
"integrity": "sha512-Uu0V8kPb0FXg+zmEjLRN3T+O1tJ17PbrJEDN/YDEkrTs0TsKFANSeCZLqGOx0tk5e/eFpDtfNguXpPI1iCQmwg=="
|
||||
},
|
||||
"@ucap/protocol-umg": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-umg/-/protocol-umg-0.0.2.tgz",
|
||||
"integrity": "sha512-PC9+c13YMoIyY+Pm3q9LQUYGePnPOmf56+n3EnztPyfcmqHOH0UL+7HqMByg+SjMKY5j+BCI6gFMnlKTtQK3Yw=="
|
||||
"version": "0.0.3",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-umg/-/protocol-umg-0.0.3.tgz",
|
||||
"integrity": "sha512-zggPmkLcBlTVnEr1qRnnx1Dam8m+7cPCaWLPdeABtiymAYBzXr3uJAtxe4/k0q46WFUHq5J/GkmbnSonH9dUKg=="
|
||||
},
|
||||
"@ucap/web-socket": {
|
||||
"version": "0.0.2",
|
||||
|
@ -2056,9 +2061,9 @@
|
|||
"integrity": "sha512-hKAEsIzMhUuR8u26ENkuIAh4Xp8ltzBlZggxhqtLifP8KbgQdWD3w3+1M1697MPni8q42+Q/ZH/1IHLdi8KB7w=="
|
||||
},
|
||||
"@ucap/web-storage": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/web-storage/-/web-storage-0.0.2.tgz",
|
||||
"integrity": "sha512-KyZlFCmEfEsMo9h1fI2mZjULfpE9PEybf1Ax5N5cR4H/IZRSYsA+pCEgV+u9RAxIn0h/fI+y2sg60bpheorEIA=="
|
||||
"version": "0.0.3",
|
||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/web-storage/-/web-storage-0.0.3.tgz",
|
||||
"integrity": "sha512-JRRCXFmTD8D82OoUZTiAbYk/R4feTAgie16kAcnVBnf2vc6yc8s6llFmREWDWhKMrhyLnYIK9A1oLElSNrmHUQ=="
|
||||
},
|
||||
"@webassemblyjs/ast": {
|
||||
"version": "1.8.5",
|
||||
|
|
29
package.json
29
package.json
|
@ -37,7 +37,7 @@
|
|||
"@ucap/api-message": "~0.0.3",
|
||||
"@ucap/api-prompt": "~0.0.3",
|
||||
"@ucap/api-public": "~0.0.3",
|
||||
"@ucap/core": "~0.0.4",
|
||||
"@ucap/core": "~0.0.5",
|
||||
"@ucap/logger": "~0.0.7",
|
||||
"@ucap/native": "~0.0.6",
|
||||
"@ucap/native-browser": "~0.0.5",
|
||||
|
@ -74,27 +74,28 @@
|
|||
"@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.8",
|
||||
"@ucap/ng-ui-organization": "~0.0.2",
|
||||
"@ucap/ng-ui-authentication": "~0.0.14",
|
||||
"@ucap/ng-ui-skin-default": "~0.0.1",
|
||||
"@ucap/pi": "~0.0.4",
|
||||
"@ucap/protocol": "~0.0.2",
|
||||
"@ucap/protocol-authentication": "~0.0.2",
|
||||
"@ucap/protocol-buddy": "~0.0.2",
|
||||
"@ucap/protocol-event": "~0.0.2",
|
||||
"@ucap/pi": "~0.0.5",
|
||||
"@ucap/protocol": "~0.0.4",
|
||||
"@ucap/protocol-authentication": "~0.0.3",
|
||||
"@ucap/protocol-buddy": "~0.0.3",
|
||||
"@ucap/protocol-event": "~0.0.3",
|
||||
"@ucap/protocol-file": "~0.0.2",
|
||||
"@ucap/protocol-group": "~0.0.2",
|
||||
"@ucap/protocol-info": "~0.0.2",
|
||||
"@ucap/protocol-group": "~0.0.3",
|
||||
"@ucap/protocol-info": "~0.0.3",
|
||||
"@ucap/protocol-inner": "~0.0.2",
|
||||
"@ucap/protocol-option": "~0.0.4",
|
||||
"@ucap/protocol-option": "~0.0.3",
|
||||
"@ucap/protocol-ping": "~0.0.2",
|
||||
"@ucap/protocol-query": "~0.0.2",
|
||||
"@ucap/protocol-room": "~0.0.2",
|
||||
"@ucap/protocol-room": "~0.0.3",
|
||||
"@ucap/protocol-service": "~0.0.2",
|
||||
"@ucap/protocol-status": "~0.0.2",
|
||||
"@ucap/protocol-status": "~0.0.3",
|
||||
"@ucap/protocol-sync": "~0.0.2",
|
||||
"@ucap/protocol-umg": "~0.0.2",
|
||||
"@ucap/protocol-umg": "~0.0.3",
|
||||
"@ucap/web-socket": "~0.0.2",
|
||||
"@ucap/web-storage": "~0.0.2",
|
||||
"@ucap/web-storage": "~0.0.3",
|
||||
"autolinker": "^3.13.0",
|
||||
"axios": "^0.19.2",
|
||||
"classlist.js": "^1.1.20150312",
|
||||
|
|
|
@ -44,6 +44,8 @@ import { AuthenticationStoreModule } from '@ucap/ng-store-authentication';
|
|||
import { GroupStoreModule } from '@ucap/ng-store-group';
|
||||
import { ChatStoreModule } from '@ucap/ng-store-chat';
|
||||
|
||||
import { OrganizationUiModule } from '@ucap/ng-ui-organization';
|
||||
|
||||
import { AppLayoutsModule } from '@app/layouts/layouts.module';
|
||||
|
||||
import { AppProviderModule } from '@app/app-provider.module';
|
||||
|
@ -107,6 +109,8 @@ import { environment } from '@environments';
|
|||
GroupStoreModule.forRoot({ useMyDeptGroup: true, fixedGroupSeqs: [] }),
|
||||
ChatStoreModule.forRoot({}),
|
||||
|
||||
OrganizationUiModule.forRoot({}),
|
||||
|
||||
AppProviderModule,
|
||||
AppRoutingModule,
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
[loginId]="userStore?.loginId"
|
||||
[disable]="disableLoginForm"
|
||||
[processing]="loginProcessing"
|
||||
[loginTry]="loginTry"
|
||||
(login)="onLogin($event)"
|
||||
>
|
||||
<div
|
||||
|
|
|
@ -7,6 +7,7 @@ import { MatCheckbox } from '@angular/material/checkbox';
|
|||
import { Store, select } from '@ngrx/store';
|
||||
|
||||
import { Company } from '@ucap/api-external';
|
||||
import { LoginTry } from '@ucap/pi';
|
||||
|
||||
import { LogService } from '@ucap/ng-logger';
|
||||
import { I18nService } from '@ucap/ng-i18n';
|
||||
|
@ -19,7 +20,7 @@ import { LoginActions } from '@ucap/ng-store-authentication';
|
|||
import { UserStore } from '@app/models/user-store';
|
||||
import { LoginSession } from '@app/models/login-session';
|
||||
import { AppKey } from '@app/types/app-key.type';
|
||||
import { take } from 'rxjs/operators';
|
||||
import { take, filter } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'app-sections-account-login',
|
||||
|
@ -52,8 +53,10 @@ export class LoginSectionComponent implements OnInit, OnDestroy {
|
|||
companyList: Company[];
|
||||
disableLoginForm = false;
|
||||
loginProcessing = false;
|
||||
loginTry: LoginTry;
|
||||
|
||||
private companyListSubscription: Subscription;
|
||||
private loginTrySubscription: Subscription;
|
||||
|
||||
constructor(
|
||||
private piService: PiService,
|
||||
|
@ -69,6 +72,8 @@ export class LoginSectionComponent implements OnInit, OnDestroy {
|
|||
AppKey.LoginSession
|
||||
);
|
||||
|
||||
this.loginTry = this.sessionStorageService.get<LoginTry>(AppKey.LoginTry);
|
||||
|
||||
this.protocolService.disconnect();
|
||||
|
||||
this.store.dispatch(
|
||||
|
@ -82,12 +87,21 @@ export class LoginSectionComponent implements OnInit, OnDestroy {
|
|||
.subscribe(companyList => {
|
||||
this.companyList = companyList;
|
||||
});
|
||||
|
||||
this.loginTrySubscription = this.sessionStorageService.changed$
|
||||
.pipe(filter(param => AppKey.LoginTry === param.key))
|
||||
.subscribe(param => {
|
||||
this.loginTry = param.value as LoginTry;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
if (!!this.companyListSubscription) {
|
||||
this.companyListSubscription.unsubscribe();
|
||||
}
|
||||
if (!!this.loginTrySubscription) {
|
||||
this.loginTrySubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
onLogin(event: {
|
||||
|
@ -113,9 +127,7 @@ export class LoginSectionComponent implements OnInit, OnDestroy {
|
|||
.subscribe(
|
||||
res => {
|
||||
if ('success' !== res.status.toLowerCase()) {
|
||||
this.store.dispatch(
|
||||
LoginActions.webLoginFailure({ error: res.status })
|
||||
);
|
||||
this.onWebLoginFailure(event, res.status);
|
||||
return;
|
||||
} else {
|
||||
this.store.dispatch(
|
||||
|
@ -132,7 +144,7 @@ export class LoginSectionComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
},
|
||||
error => {
|
||||
this.store.dispatch(LoginActions.webLoginFailure({ error }));
|
||||
this.onWebLoginFailure(event, error);
|
||||
},
|
||||
() => {
|
||||
this.disableLoginForm = false;
|
||||
|
@ -144,4 +156,18 @@ export class LoginSectionComponent implements OnInit, OnDestroy {
|
|||
onClickForgotPassword(lng: string) {
|
||||
this.i18nService.changeLanguage(lng);
|
||||
}
|
||||
|
||||
private onWebLoginFailure(
|
||||
event: {
|
||||
companyCode: string;
|
||||
loginId: string;
|
||||
loginPw: string;
|
||||
notValid: () => void;
|
||||
},
|
||||
error: any
|
||||
) {
|
||||
this.store.dispatch(LoginActions.webLoginFailure({ error }));
|
||||
|
||||
event.notValid();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ export class AppAuthenticationService {
|
|||
const loginSession = this.sessionStorageService.get<LoginSession>(
|
||||
AppKey.LoginSession
|
||||
);
|
||||
return null !== loginSession && !!loginSession.loginId;
|
||||
return !!loginSession && !!loginSession.loginId;
|
||||
}
|
||||
|
||||
async login(
|
||||
|
@ -41,7 +41,15 @@ export class AppAuthenticationService {
|
|||
rememberMe: boolean,
|
||||
autoLogin: boolean
|
||||
) {
|
||||
loginSession = { ...loginSession, localeCode: LocaleCode.Korean };
|
||||
const prevLoginSession = this.sessionStorageService.get<LoginSession>(
|
||||
AppKey.LoginSession
|
||||
);
|
||||
|
||||
loginSession = {
|
||||
...prevLoginSession,
|
||||
...loginSession,
|
||||
localeCode: LocaleCode.Korean
|
||||
};
|
||||
const encLoginPw = PasswordUtil.encrypt(loginSession.loginPw);
|
||||
|
||||
this.sessionStorageService.set<LoginSession>(AppKey.LoginSession, {
|
||||
|
|
|
@ -4,8 +4,12 @@ import { DeviceType, DesktopType } from '@ucap/core';
|
|||
import { NativeService, NativeType, OsType } from '@ucap/native';
|
||||
|
||||
import { I18nService } from '@ucap/ng-i18n';
|
||||
import { LogService } from '@ucap/ng-logger';
|
||||
import { UCAP_NATIVE_SERVICE } from '@ucap/ng-native';
|
||||
import { SessionStorageService } from '@ucap/ng-web-storage';
|
||||
import { DateService } from '@ucap/ng-ui';
|
||||
import { TranslateService } from '@ucap/ng-ui-organization';
|
||||
|
||||
import { LoginSession } from '@app/models/login-session';
|
||||
import { AppKey } from '@app/types/app-key.type';
|
||||
|
||||
|
@ -14,6 +18,9 @@ export class AppService {
|
|||
constructor(
|
||||
private sessionStorageService: SessionStorageService,
|
||||
private i18nService: I18nService,
|
||||
private translateService: TranslateService,
|
||||
private dateService: DateService,
|
||||
private logService: LogService,
|
||||
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService
|
||||
) {}
|
||||
|
||||
|
@ -53,6 +60,9 @@ export class AppService {
|
|||
desktopType
|
||||
});
|
||||
|
||||
this.dateService.setDefaultTimezone('Asia/Seoul');
|
||||
this.dateService.use('Asia/Seoul');
|
||||
|
||||
resolve();
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
|
@ -96,6 +106,8 @@ export class AppService {
|
|||
}
|
||||
})
|
||||
.then(() => {
|
||||
this.dateService.setLocale(this.i18nService.currentLng);
|
||||
|
||||
resolve();
|
||||
})
|
||||
.catch(reason => {
|
||||
|
@ -103,6 +115,16 @@ export class AppService {
|
|||
});
|
||||
});
|
||||
|
||||
return Promise.all([initSession, initI18n]);
|
||||
const initOrganization = new Promise<void>(async (resolve, reject) => {
|
||||
try {
|
||||
this.translateService.setDefaultLang('ko');
|
||||
this.translateService.use('ko');
|
||||
resolve();
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
|
||||
return Promise.all([initSession, initI18n, initOrganization]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,130 @@
|
|||
import { map, exhaustMap } from 'rxjs/operators';
|
||||
import { interval, timer } from 'rxjs';
|
||||
import { map, exhaustMap, tap, takeUntil } from 'rxjs/operators';
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injectable, Inject } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
import { Actions, createEffect, ofType } from '@ngrx/effects';
|
||||
|
||||
import { LoginTry } from '@ucap/pi';
|
||||
|
||||
import { LoginResponse } from '@ucap/protocol-authentication';
|
||||
import { NativeService } from '@ucap/native';
|
||||
|
||||
import { LogService } from '@ucap/ng-logger';
|
||||
import { SessionStorageService } from '@ucap/ng-web-storage';
|
||||
|
||||
import { UCAP_NATIVE_SERVICE } from '@ucap/ng-native';
|
||||
import { LoginActions } from '@ucap/ng-store-authentication';
|
||||
|
||||
import { AppKey } from '@app/types/app-key.type';
|
||||
import { AppAuthenticationService } from '@app/services/app-authentication.service';
|
||||
|
||||
import { environment } from '@environments';
|
||||
|
||||
@Injectable()
|
||||
export class Effects {
|
||||
readonly intervalForRetry =
|
||||
environment.productConfig.authentication.intervalForRetry;
|
||||
readonly maxTryCount = environment.productConfig.authentication.maxTryCount;
|
||||
|
||||
webLoginSuccess$ = createEffect(
|
||||
() =>
|
||||
this.actions$.pipe(
|
||||
ofType(LoginActions.webLoginSuccess),
|
||||
tap(params => {
|
||||
this.nativeService.checkForUpdates(params.login2Response.version);
|
||||
this.appAuthenticationService.login(
|
||||
{
|
||||
companyCode: params.companyCode,
|
||||
loginId: params.loginId,
|
||||
loginPw: params.loginPw
|
||||
},
|
||||
params.rememberMe,
|
||||
params.autoLogin
|
||||
);
|
||||
this.router.navigate(['/']);
|
||||
})
|
||||
),
|
||||
{ dispatch: false }
|
||||
);
|
||||
|
||||
webLoginFailure$ = createEffect(
|
||||
() =>
|
||||
this.actions$.pipe(
|
||||
ofType(LoginActions.webLoginFailure),
|
||||
tap(params => {
|
||||
let loginTry = this.sessionStorageService.get<LoginTry>(
|
||||
AppKey.LoginTry
|
||||
);
|
||||
loginTry = loginTry || {
|
||||
failCount: 0,
|
||||
lastFailTime: null,
|
||||
remainTimeForNextTry: null
|
||||
};
|
||||
|
||||
if (null === loginTry.lastFailTime) {
|
||||
loginTry = {
|
||||
failCount: loginTry.failCount + 1,
|
||||
lastFailTime: new Date().getTime(),
|
||||
remainTimeForNextTry: null
|
||||
};
|
||||
} else {
|
||||
const diff = Math.round(
|
||||
(new Date().getTime() - loginTry.lastFailTime) / 1000
|
||||
);
|
||||
|
||||
if (diff > this.intervalForRetry) {
|
||||
loginTry = {
|
||||
failCount: 1,
|
||||
lastFailTime: new Date().getTime(),
|
||||
remainTimeForNextTry: null
|
||||
};
|
||||
} else {
|
||||
loginTry.failCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.maxTryCount <= loginTry.failCount) {
|
||||
loginTry.remainTimeForNextTry = this.intervalForRetry;
|
||||
|
||||
const waitTimer$ = timer(1000 * this.intervalForRetry);
|
||||
interval(1000)
|
||||
.pipe(takeUntil(waitTimer$))
|
||||
.subscribe(
|
||||
v => {
|
||||
loginTry.remainTimeForNextTry = this.intervalForRetry - v;
|
||||
this.sessionStorageService.set<LoginTry>(
|
||||
AppKey.LoginTry,
|
||||
loginTry
|
||||
);
|
||||
},
|
||||
error => {},
|
||||
() => {
|
||||
loginTry = {
|
||||
failCount: 0,
|
||||
lastFailTime: null,
|
||||
remainTimeForNextTry: null
|
||||
};
|
||||
this.sessionStorageService.set<LoginTry>(
|
||||
AppKey.LoginTry,
|
||||
loginTry
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
this.sessionStorageService.set<LoginTry>(AppKey.LoginTry, loginTry);
|
||||
})
|
||||
),
|
||||
{ dispatch: false }
|
||||
);
|
||||
|
||||
constructor(
|
||||
private actions$: Actions,
|
||||
private sessionStorageService: SessionStorageService
|
||||
private sessionStorageService: SessionStorageService,
|
||||
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
|
||||
private appAuthenticationService: AppAuthenticationService,
|
||||
private router: Router,
|
||||
private logService: LogService
|
||||
) {}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
export enum AppKey {
|
||||
LoginTry = 'ucap::LG::LOGIN_TRY',
|
||||
LoginSession = 'ucap::LG::LOGIN_SESSION',
|
||||
LogoutSession = 'ucap::LG::LOGOUT_SESSION',
|
||||
UserStore = 'ucap::LG::USER_STORE',
|
||||
|
|
|
@ -12,9 +12,11 @@
|
|||
"loginPw": "Login Password"
|
||||
},
|
||||
"errors": {
|
||||
"requireCompany": "",
|
||||
"requireLoginId": "",
|
||||
"requireLoginPw": ""
|
||||
"requireCompany": "Company is required.",
|
||||
"requireLoginId": "ID is required.",
|
||||
"requireLoginPw": "password is required.",
|
||||
"failed": "Failed to login",
|
||||
"attemptsExceeded": "Password error count exceeded."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,11 @@
|
|||
"loginPw": "로그인 비밀번호"
|
||||
},
|
||||
"errors": {
|
||||
"requireCompany": "",
|
||||
"requireLoginId": "",
|
||||
"requireLoginPw": ""
|
||||
"requireCompany": "회사를 입력해 주세요.",
|
||||
"requireLoginId": "아이디를 입력해 주세요.",
|
||||
"requireLoginPw": "비밀번호를 입력해 주세요.",
|
||||
"failed": "로그인에 실패하였습니다.",
|
||||
"attemptsExceeded": "비밀번호 오류 횟수 초과입니다."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,9 @@ export const environment: Environment = {
|
|||
authentication: {
|
||||
usePrivateInformationAgree: false,
|
||||
useRememberMe: true,
|
||||
useAutoLogin: true
|
||||
useAutoLogin: true,
|
||||
maxTryCount: 5,
|
||||
intervalForRetry: 1 * 60
|
||||
},
|
||||
profile: {
|
||||
editableProfileImage: false
|
||||
|
|
|
@ -64,7 +64,9 @@ export const environment: Environment = {
|
|||
authentication: {
|
||||
usePrivateInformationAgree: false,
|
||||
useRememberMe: true,
|
||||
useAutoLogin: true
|
||||
useAutoLogin: true,
|
||||
maxTryCount: 5,
|
||||
intervalForRetry: 1 * 60
|
||||
},
|
||||
profile: {
|
||||
editableProfileImage: false
|
||||
|
|
|
@ -67,7 +67,9 @@ export const environment: Environment = {
|
|||
authentication: {
|
||||
usePrivateInformationAgree: false,
|
||||
useRememberMe: true,
|
||||
useAutoLogin: true
|
||||
useAutoLogin: true,
|
||||
maxTryCount: 5,
|
||||
intervalForRetry: 1 * 60
|
||||
},
|
||||
profile: {
|
||||
editableProfileImage: false
|
||||
|
|
|
@ -61,6 +61,8 @@ export interface Environment {
|
|||
usePrivateInformationAgree: boolean;
|
||||
useRememberMe: boolean;
|
||||
useAutoLogin: boolean;
|
||||
maxTryCount: number;
|
||||
intervalForRetry: number;
|
||||
};
|
||||
profile: {
|
||||
/** 내 프로필 이미지 수정 가능 여부 */
|
||||
|
|
|
@ -5,16 +5,14 @@
|
|||
"outDir": "./dist/out-tsc",
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"target": "es2015",
|
||||
"lib": [
|
||||
"es2018",
|
||||
"dom"
|
||||
],
|
||||
"lib": ["es2018", "dom"],
|
||||
"types": ["node"],
|
||||
"paths": {
|
||||
"@app/*": ["src/app/*"],
|
||||
|
|
Loading…
Reference in New Issue
Block a user