我在这里有一个登录页面,有时当我登录到应用程序时,它返回登录页面,而不是进入仪表板,但会话开始在后台运行。因此,我只是将网址从<?php $mypage = get_page_by_title('my page'); ?>
<p><?php the_field('custom_field', $mypage); ?></p>
更改为http://localhost:4200/account/login
,它出现在主页上。为什么会这样呢?对此有什么解决方案?我在这里发布我的登录服务代码和login.component.ts代码
Login.component.ts
http://localhost:4200
login.service.ts
import { AppConsts } from '@shared/AppConsts';
import { Component, Injector, ElementRef, ViewChild, ViewEncapsulation,
OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { AppComponentBase } from '@shared/app-component-base';
import { LoginService } from './login.service';
import { accountModuleAnimation } from '@shared/animations/routerTransition';
import { AbpSessionService } from '@abp/session/abp-session.service';
import { SharedDataService } from '@shared/service-proxies/service-proxies';
import { IsTenantAvailableInput } from '@shared/service-proxies/service-
proxies';
import { AccountServiceProxy, EmailConfirmationDto } from '@shared/service-
proxies/service-proxies';
@Component({
templateUrl: './login.component.html',
encapsulation: ViewEncapsulation.None,
styleUrls: [
'./login.component.less'
],
animations: [accountModuleAnimation()]
})
export class LoginComponent extends AppComponentBase implements OnInit {
@ViewChild('cardBody') cardBody: ElementRef;
submitting: boolean = false;
tenantName: string | undefined;
user: EmailConfirmationDto = new EmailConfirmationDto();
active: boolean = false;
saving: boolean = false;
constructor(
injector: Injector,
public loginService: LoginService,
private _router: Router,
private _sessionService: AbpSessionService,
private _sharedDataService: SharedDataService
) {
super(injector);
if (this._sharedDataService.getMessage()) {
this.tenantName = this._sharedDataService.getMessage();
this._sharedDataService.setId(undefined);
} else if (this._sharedDataService.getId()) {
this.tenantName = undefined;
this._sharedDataService.setId(undefined);
} else {
this.tenantName = (!this.appSession.tenant ? undefined : this.appSession.tenant.tenancyName);
}
}
ngOnInit() {
}
ngAfterViewInit(): void {
$(this.cardBody.nativeElement).find('input:first').focus();
}
get multiTenancySideIsTeanant(): boolean {
return this._sessionService.tenantId > 0;
}
get isSelfRegistrationAllowed(): boolean {
if (!this._sessionService.tenantId) {
return false;
}
return true;
}
login(): void {
this.submitting = true;
this.loginService.authenticate(
() => this.submitting = false
);
}