mirror of https://github.com/abpframework/abp.git
committed by
GitHub
16 changed files with 911 additions and 365 deletions
@ -1,2 +1,4 @@ |
|||
import * as Web from './web'; |
|||
export * from './account.service'; |
|||
export * from './models'; |
|||
export { Web }; |
|||
|
|||
@ -0,0 +1,35 @@ |
|||
import type { AbpLoginResult, UserLoginInfo } from './models/models'; |
|||
import { RestService } from '@abp/ng.core'; |
|||
import { Injectable } from '@angular/core'; |
|||
|
|||
@Injectable({ |
|||
providedIn: 'root', |
|||
}) |
|||
export class AccountService { |
|||
apiName = 'AbpAccount'; |
|||
|
|||
checkPasswordByLogin = (login: UserLoginInfo) => |
|||
this.restService.request<any, AbpLoginResult>({ |
|||
method: 'POST', |
|||
url: '/api/account/check-password', |
|||
body: login, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
loginByLogin = (login: UserLoginInfo) => |
|||
this.restService.request<any, AbpLoginResult>({ |
|||
method: 'POST', |
|||
url: '/api/account/login', |
|||
body: login, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
logout = () => |
|||
this.restService.request<any, void>({ |
|||
method: 'GET', |
|||
url: '/api/account/logout', |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
constructor(private restService: RestService) {} |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
import * as Models from './models'; |
|||
export * from './account.service'; |
|||
export { Models }; |
|||
@ -0,0 +1,2 @@ |
|||
export * from './login-result-type.enum'; |
|||
export * from './models'; |
|||
@ -0,0 +1,11 @@ |
|||
import { mapEnumToOptions } from '@abp/ng.core'; |
|||
|
|||
export enum LoginResultType { |
|||
Success = 1, |
|||
InvalidUserNameOrPassword = 2, |
|||
NotAllowed = 3, |
|||
LockedOut = 4, |
|||
RequiresTwoFactor = 5, |
|||
} |
|||
|
|||
export const loginResultTypeOptions = mapEnumToOptions(LoginResultType); |
|||
@ -0,0 +1,12 @@ |
|||
import type { LoginResultType } from './login-result-type.enum'; |
|||
|
|||
export interface AbpLoginResult { |
|||
result: LoginResultType; |
|||
description?: string; |
|||
} |
|||
|
|||
export interface UserLoginInfo { |
|||
userNameOrEmailAddress: string; |
|||
password: string; |
|||
rememberMe: boolean; |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
import * as Controllers from './controllers'; |
|||
export { Controllers }; |
|||
@ -0,0 +1,2 @@ |
|||
import * as Account from './account'; |
|||
export { Account }; |
|||
@ -0,0 +1,2 @@ |
|||
import * as Areas from './areas'; |
|||
export { Areas }; |
|||
File diff suppressed because it is too large
Loading…
Reference in new issue