/** * Created by oswaldogallango on 7/11/16. */ import { CoreWebService } from './core-web.service'; import { Observable } from 'rxjs/Rx'; import { Router } from '@angular/router'; import { DotcmsEventsService } from './dotcms-events.service'; import { LoggerService } from './logger.service'; /** * This Service get the server configuration to display in the login component * and execute the login and forgot password routines */ export declare class LoginService { private router; private coreWebService; private dotcmsEventsService; private loggerService; private _auth$; private _logout$; private _auth; private _loginAsUsersList$; private country; private lang; private urls; private nUsers; constructor(router: Router, coreWebService: CoreWebService, dotcmsEventsService: DotcmsEventsService, loggerService: LoggerService); readonly loginAsUsersList$: Observable; readonly auth$: Observable; readonly logout$: Observable; readonly auth: Auth; readonly isLogin$: Observable; /** * Load _auth information. * @returns {Observable} */ loadAuth(): Observable; /** * Change password * @param password * @param token * @returns {Observable} */ changePassword(password: string, token: string): Observable; /** * Get the server information to configure the login component * @param language language and country to get the internationalized messages * @param i18nKeys array of message key to internationalize * @returns {Observable} Observable with an array of internationalized messages and server configuration info */ getLoginFormInfo(language: string, i18nKeys: Array): Observable; /** * Do the login as request and return an Observable. * @param user user to loginas * @param password loginin user's password * @returns {Observable} */ loginAs(userData: { user: User; password: string; }): Observable; /** * Executes the call to the login rest api * @param login User email or user id * @param password User password * @param rememberMe boolean indicating if the _auth want to use or not the remenber me option * @param language string with the language and country code, ex: en_US * @returns an array with the user if the user logged in successfully or the error message */ loginUser(login: string, password: string, rememberMe: boolean, language: string): Observable; /** * Logout "login as" user * @returns {Observable} */ logoutAs(): Observable; /** * Call the logout rest api * @returns {Observable} */ logOutUser(): Observable; /** * Executes the call to the recover passwrod rest api * @param email User email address * @returns an array with message indicating if the recover password was successfull * or if there is an error */ recoverPassword(login: string): Observable; /** * Subscribe to ser change and call received function on change. * @param func function will call when user change */ watchUser(func: Function): void; /** * Set logged_auth and update auth Observable * @param _auth */ setAuth(auth: Auth): void; private isLogoutAfterLastLogin(date); /** * update the language and country variables from the string * @param language string containing the language and country */ private setLanguage(language); /** * Request and store the login as _auth list. */ private loadLoginAsUsersList(includeNUsers, filter); } export interface User { active?: boolean; actualCompanyId?: string; birthday?: number; comments?: string; companyId?: string; createDate?: number; deleteDate?: number; deleteInProgress?: boolean; emailAddress: string; failedLoginAttempts?: number; female?: boolean; firstName: string; fullName?: string; id?: string; languageId?: string; lastLoginDate?: number; lastLoginIP?: string; lastName: string; male?: boolean; middleName?: string; modificationDate?: number; name?: string; nickname?: string; requestPassword?: boolean; timeZoneId?: string; type?: string; userId: string; password?: string; loggedInDate: number; } export interface Auth { user: User; loginAsUser: User; isLoginAs?: boolean; }