| | |
| | | import { Authorization } from '@business/entity/token'; |
| | | import { LoginService } from './../../../business/services/http/login.service'; |
| | | import { LoginService } from '@business/services/http/login.service'; |
| | | import { SettingsService } from '@delon/theme'; |
| | | import { Component, OnDestroy, Inject } from '@angular/core'; |
| | | import { Router } from '@angular/router'; |
| | |
| | | import { NzMessageService } from 'ng-zorro-antd'; |
| | | import { SocialService, SocialOpenType, ITokenService, DA_SERVICE_TOKEN } from '@delon/auth'; |
| | | import { environment } from '@env/environment'; |
| | | import { CookieService } from 'angular2-cookie/services/cookies.service'; |
| | | @Component({ |
| | | selector: 'passport-login', |
| | | templateUrl: './login.component.html', |
| | | styleUrls: [ './login.component.less' ], |
| | | providers: [ SocialService] |
| | | providers: [ SocialService,CookieService] |
| | | }) |
| | | export class UserLoginComponent implements OnDestroy { |
| | | |
| | |
| | | captcha: [null, [Validators.required]], |
| | | remember: [true] |
| | | }); |
| | | // let nowTime = new Date(); |
| | | // nowTime.setDate(nowTime.getDate()+1); |
| | | } |
| | | |
| | | // region: fields |
| | |
| | | name: this.userName.value, |
| | | time: +new Date |
| | | }); |
| | | this.validateError = true; |
| | | this.validateError = {}; |
| | | this.router.navigate(['/']); |
| | | } |
| | | }, |
| | | (err) => { |
| | | console.log(err); |
| | | // console.log(err); |
| | | if(err instanceof ProgressEvent){ |
| | | const error = <ProgressEvent>err; |
| | | let xmlHttp = error.target; |
| | |
| | | console.log(xmlHttpRequest.response); |
| | | const response = JSON.parse(xmlHttpRequest.response); |
| | | if(response.status == 401&&response.errorCode==10){ |
| | | this.validateError = true; |
| | | this.validateError["password_incorrect"]=true; |
| | | this.loading = false; |
| | | } else if(response.status == 401&&response.errorCode==12) { |
| | | this.validateError["account_expired"]=true; |
| | | this.loading = false; |
| | | } |
| | | } |
| | | } |
| | |
| | | ); |
| | | |
| | | } |
| | | public validateError:boolean; |
| | | public validateError:{[s:string]:boolean} = {}; |
| | | // region: social |
| | | |
| | | open(type: string, openType: SocialOpenType = 'href') { |