fix(account): add tenant header to token request

pull/2211/head
mehmet-erim 6 years ago
parent 24458a5248
commit dce97779e5

@ -10,29 +10,34 @@
"scripts:build": "cd scripts && npm install && npm run build"
},
"devDependencies": {
"@abp/ng.account.config": "^1.0.2",
"@abp/ng.core": "^1.0.2",
"@abp/ng.feature-management": "^1.0.2",
"@abp/ng.identity.config": "^1.0.2",
"@abp/ng.permission-management": "^1.0.2",
"@abp/ng.setting-management.config": "^1.0.2",
"@abp/ng.tenant-management.config": "^1.0.2",
"@abp/ng.theme.shared": "^1.0.2",
"@abp/ng.account.config": "^1.0.3",
"@abp/ng.core": "^1.0.3",
"@abp/ng.feature-management": "^1.0.3",
"@abp/ng.identity.config": "^1.0.3",
"@abp/ng.permission-management": "^1.0.3",
"@abp/ng.setting-management.config": "^1.0.3",
"@abp/ng.tenant-management.config": "^1.0.3",
"@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-devkit/build-angular": "~0.803.18",
"@angular-devkit/build-ng-packagr": "~0.803.18",
"@angular/animations": "~8.2.13",
"@angular/cdk": "^8.2.3",
"@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-cli": "~8.2.13",
"@angular/core": ">=8.0.0 <9.0.0",
"@angular/forms": ">=8.0.0 <9.0.0",
"@angular/core": "~8.2.13",
"@angular/forms": "~8.2.13",
"@angular/language-service": "~8.2.13",
"@angular/platform-browser": "~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",
"@ng-bootstrap/ng-bootstrap": "^5.1.4",
"@ngneat/spectator": "^4.5.0",

@ -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 { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Navigate } from '@ngxs/router-plugin';
@ -9,6 +9,7 @@ import { Options } from '../../models/options';
import { ToasterService } from '@abp/ng.theme.shared';
import { catchError, finalize, switchMap, tap } from 'rxjs/operators';
import snq from 'snq';
import { HttpHeaders } from '@angular/common/http';
const { maxLength, minLength, required } = Validators;
@ -43,8 +44,13 @@ export class LoginComponent {
// this.oauthService.setStorage(this.form.value.remember ? localStorage : sessionStorage);
this.inProgress = true;
const tenant = this.store.selectSnapshot(SessionState.getTenant);
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(
switchMap(() => this.store.dispatch(new GetAppConfiguration())),

Loading…
Cancel
Save