Browse Source

fix(account): add tenant header to token request

pull/2211/head
mehmet-erim 7 years ago
parent
commit
dce97779e5
  1. 29
      npm/ng-packs/package.json
  2. 10
      npm/ng-packs/packages/account/src/lib/components/login/login.component.ts

29
npm/ng-packs/package.json

@ -10,29 +10,34 @@
"scripts:build": "cd scripts && npm install && npm run build" "scripts:build": "cd scripts && npm install && npm run build"
}, },
"devDependencies": { "devDependencies": {
"@abp/ng.account.config": "^1.0.2", "@abp/ng.account.config": "^1.0.3",
"@abp/ng.core": "^1.0.2", "@abp/ng.core": "^1.0.3",
"@abp/ng.feature-management": "^1.0.2", "@abp/ng.feature-management": "^1.0.3",
"@abp/ng.identity.config": "^1.0.2", "@abp/ng.identity.config": "^1.0.3",
"@abp/ng.permission-management": "^1.0.2", "@abp/ng.permission-management": "^1.0.3",
"@abp/ng.setting-management.config": "^1.0.2", "@abp/ng.setting-management.config": "^1.0.3",
"@abp/ng.tenant-management.config": "^1.0.2", "@abp/ng.tenant-management.config": "^1.0.3",
"@abp/ng.theme.shared": "^1.0.2", "@abp/ng.theme.shared": "^1.0.3",
"@abp/ng.theme.basic": "^1.0.3",
"@abp/ng.account": "^1.0.3",
"@abp/ng.identity": "^1.0.3",
"@abp/ng.setting-management": "^1.0.3",
"@abp/ng.tenant-management": "^1.0.3",
"@angular-builders/jest": "^8.2.0", "@angular-builders/jest": "^8.2.0",
"@angular-devkit/build-angular": "~0.803.18", "@angular-devkit/build-angular": "~0.803.18",
"@angular-devkit/build-ng-packagr": "~0.803.18", "@angular-devkit/build-ng-packagr": "~0.803.18",
"@angular/animations": "~8.2.13", "@angular/animations": "~8.2.13",
"@angular/cdk": "^8.2.3", "@angular/cdk": "^8.2.3",
"@angular/cli": "~8.3.18", "@angular/cli": "~8.3.18",
"@angular/common": ">=8.0.0 <9.0.0", "@angular/common": "~8.2.13",
"@angular/compiler": "~8.2.13", "@angular/compiler": "~8.2.13",
"@angular/compiler-cli": "~8.2.13", "@angular/compiler-cli": "~8.2.13",
"@angular/core": ">=8.0.0 <9.0.0", "@angular/core": "~8.2.13",
"@angular/forms": ">=8.0.0 <9.0.0", "@angular/forms": "~8.2.13",
"@angular/language-service": "~8.2.13", "@angular/language-service": "~8.2.13",
"@angular/platform-browser": "~8.2.13", "@angular/platform-browser": "~8.2.13",
"@angular/platform-browser-dynamic": "~8.2.13", "@angular/platform-browser-dynamic": "~8.2.13",
"@angular/router": ">=8.0.0 <9.0.0", "@angular/router": "~8.2.13",
"@fortawesome/fontawesome-free": "^5.11.2", "@fortawesome/fontawesome-free": "^5.11.2",
"@ng-bootstrap/ng-bootstrap": "^5.1.4", "@ng-bootstrap/ng-bootstrap": "^5.1.4",
"@ngneat/spectator": "^4.5.0", "@ngneat/spectator": "^4.5.0",

10
npm/ng-packs/packages/account/src/lib/components/login/login.component.ts

@ -1,4 +1,4 @@
import { GetAppConfiguration, ConfigState } from '@abp/ng.core'; import { GetAppConfiguration, ConfigState, SessionState } from '@abp/ng.core';
import { Component, Inject, Optional } from '@angular/core'; import { Component, Inject, Optional } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Navigate } from '@ngxs/router-plugin'; import { Navigate } from '@ngxs/router-plugin';
@ -9,6 +9,7 @@ import { Options } from '../../models/options';
import { ToasterService } from '@abp/ng.theme.shared'; import { ToasterService } from '@abp/ng.theme.shared';
import { catchError, finalize, switchMap, tap } from 'rxjs/operators'; import { catchError, finalize, switchMap, tap } from 'rxjs/operators';
import snq from 'snq'; import snq from 'snq';
import { HttpHeaders } from '@angular/common/http';
const { maxLength, minLength, required } = Validators; const { maxLength, minLength, required } = Validators;
@ -43,8 +44,13 @@ export class LoginComponent {
// this.oauthService.setStorage(this.form.value.remember ? localStorage : sessionStorage); // this.oauthService.setStorage(this.form.value.remember ? localStorage : sessionStorage);
this.inProgress = true; this.inProgress = true;
const tenant = this.store.selectSnapshot(SessionState.getTenant);
from( from(
this.oauthService.fetchTokenUsingPasswordFlow(this.form.get('username').value, this.form.get('password').value), this.oauthService.fetchTokenUsingPasswordFlow(
this.form.get('username').value,
this.form.get('password').value,
new HttpHeaders({ ...(tenant && tenant.id && { __tenant: tenant.id }) }),
),
) )
.pipe( .pipe(
switchMap(() => this.store.dispatch(new GetAppConfiguration())), switchMap(() => this.store.dispatch(new GetAppConfiguration())),

Loading…
Cancel
Save