File

core/login/login.service.ts

Description

Service to manage the login.

Index

Properties
Methods

Constructor

constructor(client: FetchClient, basicAuth: BasicAuth, cookieAuth: CookieAuth, ui: AppStateService, user: UserService, tenant: TenantService, realtime: Realtime, alert: AlertService, api: ApiService, location: LocationStrategy)
Parameters :
Name Type Optional
client FetchClient No
basicAuth BasicAuth No
cookieAuth CookieAuth No
ui AppStateService No
user UserService No
tenant TenantService No
realtime Realtime No
alert AlertService No
api ApiService No
location LocationStrategy No

Methods

addSuccessMessage
addSuccessMessage(successKey: string)

Adds a new success message

Parameters :
Name Type Optional Description
successKey string No

The key of the success message as used in SUCCESS_MESSAGES

Returns : void
Async authFulfilled
authFulfilled(tenant?, user?, supportUserName?)

Saves tenant, user and support user info to the app state.

Parameters :
Name Optional Description
tenant Yes

The current tenant object.

user Yes

The current user object.

supportUserName Yes

The current support user name.

Returns : any
autoLogout
autoLogout()
Returns : void
cleanMessages
cleanMessages()

Clears all backend errors.

Returns : void
Async generateOauthToken
generateOauthToken(credentials?: ICredentials)
Parameters :
Name Type Optional
credentials ICredentials Yes
Returns : {}
getAuthStrategy
getAuthStrategy()

Returns the current strategy. Defaults to cookie, if a token is found in local or session storage we switch to basic auth.

Returns : IAuthentication

The current auth strategy.

Async getEnforcePasswordStrength
getEnforcePasswordStrength(refresh?)

Checks if password strength is enforced for system by retrieving value of enforceStrength property from loginOptions response

Parameters :
Name Optional Description
refresh Yes

boolean used to refresh the app state where result of loginOptions response is stored. If false, it takes value from memory, if true, it refresh the app state value and then retrives data.

Returns : {}

boolean value, true if enforced, false otherwise.

Async getGreenMinLength
getGreenMinLength()

Gets the minimal number of characters that a password should have to be considered a “green” strong one.

Returns : {}

The min length for password or default value.

Async getPasswordStrengthEnforced
getPasswordStrengthEnforced(options?)

Function determines if enforced strength checks should be enabled for current tenant based on properties retrieved from loginOptions

Parameters :
Name Optional Description
options Yes

object containing specific options:

  • {refresh: true} - refreshes values of app state and returns fresh values as result of call
Returns : {}

boolean value, true if strength is enforced for tenant, false otherwise.

Async getPasswordStrengthValidity
getPasswordStrengthValidity(refresh?)

Checks if password strength is enforced for particular tenant by retrieving value of strengthValidity property from loginOptions response

Parameters :
Name Optional Description
refresh Yes

boolean used to refresh the app state where result of loginOptions response is stored. If false, it takes value from memory, if true, it refresh the app state value and then retrives data.

Returns : {}

boolean value, true if enforced, false otherwise.

getTenant
getTenant()

Returns the current tenant.

Returns : any

The tenant name.

initLoginOptions
initLoginOptions()
Returns : void
isPasswordGrantLogin
isPasswordGrantLogin(credentials?: ICredentials)
Parameters :
Name Type Optional
credentials ICredentials Yes
Returns : boolean
isSupportUser
isSupportUser(credentials?: ICredentials)

Verifies if the provided credentials use a support user to log in or not.

Parameters :
Name Type Optional Description
credentials ICredentials Yes

Credentials to check.

Returns : boolean

True if user is a support user.

Async login
login(auth: IAuthentication, credentials?: ICredentials)

Tries to login a user with the given credentials. If successful, the current tenant and user is set. If not an error is thrown. It also verifies if the user is allowed to open the current app.

Parameters :
Name Type Optional Default value Description
auth IAuthentication No this.getAuthStrategy()

The authentication strategy used.

credentials ICredentials Yes

The credentials to try to login.

Returns : any
Async logout
logout(reload)

Logs the user out

Parameters :
Name Optional Default value Description
reload No true

If set to false, the page will not reload

Returns : any
redirectToOauth
redirectToOauth()
Returns : void
Async reset
reset()

Resets the stored auth-data

Returns : {}
saveTFAToken
saveTFAToken(tfaToken: string, storage: Storage)

Saves the TFA token to local or session storage.

Parameters :
Name Type Optional Description
tfaToken string No

The tfa token to save.

storage Storage No

The storage to use (local or session).

Returns : void
showTenant
showTenant()

Verifies if the tenant input field should be shown or not.

Returns : boolean

If true, show the tenant input.

Async switchLoginMode
switchLoginMode(credentials?: ICredentials)

Switch the login mode to CookieAuth if the user has configured to use it in loginOptions.

Parameters :
Name Type Optional Description
credentials ICredentials Yes

The credentials for that login

Returns : {}
useBasicAuth
useBasicAuth(credentials: ICredentials)

Forces the use of basic auth as strategy with this credentials.

Parameters :
Name Type Optional Description
credentials ICredentials No

The credentials to use.

Returns : any
Async verifyAppAccess
verifyAppAccess()

Request the manifest -> on 401 user has no access to that application and we throw the error up to the login form.

Returns : any

Properties

ERROR_MESSAGES
ERROR_MESSAGES: object
Type : object
Default value : { minlength: gettext('Password must have at least 8 characters and no more than 32.'), password_missmatch: gettext('Password confirmation does not match.'), maxlength: gettext('Password must have at least 8 characters and no more than 32.'), password_strength: gettext( 'Your password is not strong enough. Please include numbers, lower and upper case characters' ), remote_error: gettext('Server error occurred.'), email: gettext('Invalid email address.'), password_change: gettext('Your password is expired. Please set a new password.'), password_reset_token_expired: gettext( 'Password reset link expired. Please enter your email address to receive a new one.' ), tfa_pin_invalid: gettext('The code you entered is invalid. Please try again.'), pattern_phonenumber: gettext( 'Invalid phone number format. Only digits, spaces, slashes ("/") and dashes ("-") allowed.' ), pattern_newPassword: gettext( 'Password must have at least 8 characters and no more than 32 and can only contain letters, numbers and following symbols: `~!@#$%^&*()_|+-=?;:\'",.<>{}[]\\/' ), international_number_required: gettext( 'International phone number required, in the format +49 9 876 543 210.' ), phone_number_error: gettext('Could not update phone number.'), pinAlreadySent: gettext( 'The verification code was already sent. For a new verification code, please click on the link above.' ), passwordConfirm: gettext('Password confirmation does not match.'), tfaExpired: gettext('Two-factor authentication token expired.') }
GREEN_MIN_LENGTH_DEFAULT
GREEN_MIN_LENGTH_DEFAULT: number
Type : number
Default value : 8
isFirstLogin
isFirstLogin:
Default value : true
loginMode
loginMode: any
Type : any
oauthOptions
oauthOptions: any
Type : any
rememberMe
rememberMe: boolean
Type : boolean
Default value : false
TFATOKEN_KEY
TFATOKEN_KEY: string
Type : string
Default value : 'TFAToken'
TOKEN_KEY
TOKEN_KEY: string
Type : string
Default value : '_tcy8'

result-matching ""

    No results matching ""