File

src/ui/builtin/login/smart-login.component.ts

Implements

OnInit OnDestroy

Metadata

Index

Properties
Methods

Constructor

constructor(smartServiceAdapter: SmartServiceAdapter, smartConfig: SmartConfig, route: ActivatedRoute, router: Router, errorHandler: SmartErrorHandlerService, changeDetector: ChangeDetectorRef, injector: Injector, navigationService: SmartNavigationService)
Parameters :
Name Type Optional
smartServiceAdapter SmartServiceAdapter No
smartConfig SmartConfig No
route ActivatedRoute No
router Router No
errorHandler SmartErrorHandlerService No
changeDetector ChangeDetectorRef No
injector Injector No
navigationService SmartNavigationService No

Methods

Public login
login(username: string, password: string)

Sets the login credentials and triggers login.

Parameters :
Name Type Optional Description
username string No

the username

password string No

the password

Returns : void
Public onValueChange
onValueChange()

Clear error states of inputs on value change

Returns : void
Public setLoginCredentials
setLoginCredentials(username: string, password: string)

Sets the login credentials for the login form.

Parameters :
Name Type Optional Description
username string No

the username

password string No

the password

Returns : void

Properties

authenticated
Type : boolean
buttons
Type : DialogButtons[]
Default value : []
errors
Type : object
Default value : { username: false, password: false }
errorTitle
Type : string
Default value : 'Login failed. Please try again.'
generalError
Type : unknown
Default value : false
generalErrorTitle
Type : string
Default value : 'Unable to login. The application server is not available.'
Public Readonly injector
Type : Injector
loginDialog
Type : SmartDialogComponent
Decorators :
@ViewChild(SmartDialogComponent, {static: true})
loginError
Type : unknown
Default value : false
password
Type : string
passwordInput
Type : ElementRef<HTMLInputElement>
Decorators :
@ViewChild('passwordInput', {read: ElementRef})
Public smartConfig
Type : SmartConfig
title
Type : string
Default value : 'Login'
userName
Type : string
usernameInput
Type : ElementRef<HTMLInputElement>
Decorators :
@ViewChild('usernameInput', {read: ElementRef})
<!--
**************************************************************************
* Copyright © 2006-2026 by Consultingwerk Ltd. ("CW") -                  *
* www.consultingwerk.com and other contributors as listed                *
* below. All Rights Reserved.                                            *
*                                                                        *
*  Software is distributed on an "AS IS", WITHOUT WARRANTY OF ANY        *
*   KIND, either express or implied.                                     *
*                                                                        *
*  Contributors:                                                         *
*                                                                        *
**************************************************************************

--------------------------------------------------------------------------
    File        : smart-login.component.html
    Purpose     : Template for Smart Login.
    Author(s)   : Radu Nicoara
    Created     : Dec 07, 2017
--------------------------------------------------------------------------
-->
<smart-dialog
    class="login-dialog"
    [title]="loginError || generalError ? (loginError ? errorTitle : generalErrorTitle) : title"
    [templateRef]="dialogTemplate"
    submit-on-enter="login"
    [hideCloseButton]="true"
    [width]="460"
    [injector]="injector"
    [buttons]="buttons">
</smart-dialog>
<ng-template #dialogTemplate>
    <form class="k-form k-form-md k-form-horizontal login-form" #loginForm>
        <kendo-formfield orientation="horizontal">
            <kendo-label
                labelCssClass="k-form-label"
                [for]="usernameInput"
                text="Username"
            ></kendo-label>
            <input kendoTextBox
                #usernameInput
                id="username"
                name="username"
                size="small" 
                rounded="small" 
                fillMode="flat" 
                [(ngModel)]="userName"
                [ngClass]="{'invalid' : errors.username===true}"
                (ngModelChange)="onValueChange()"
                type="text"
                required
            />
        </kendo-formfield>

        <kendo-formfield orientation="horizontal">
            <kendo-label
                labelCssClass="k-form-label"
                [for]="passwordInput"
                text="Password"
            ></kendo-label>
            <input kendoTextBox
                #passwordInput
                size="small" 
                rounded="small" 
                fillMode="flat" 
                [(ngModel)]="password"
                [ngClass]="{'invalid' : errors.password===true}"
                (ngModelChange)="onValueChange()"
                id="password" 
                name="password" 
                type="password"
                required
            />
        </kendo-formfield>
    </form>
</ng-template>

./smart-login.component.css

/**********************************************************************
 * Copyright © 2006-2026 by Consultingwerk Ltd. ("CW") -              *
 * www.consultingwerk.com and other contributors as listed            *
 * below. All Rights Reserved.                                        *
 *                                                                    *
 *  Software is distributed on an "AS IS", WITHOUT WARRANTY OF ANY    *
 *   KIND, either express or implied.                                 *
 *                                                                    *
 *  Contributors:                                                     *
 *                                                                    *
 **********************************************************************/
/*------------------------------------------------------------------------
    File        : smart-login.component.css
    Purpose     : Styles for Smart Login.
    Author(s)   : Oana Sucigan
    Created     : Nov 20, 2019
  ----------------------------------------------------------------------*/

::ng-deep .login-dialog .k-button {
    text-transform: uppercase;
}

::ng-deep .k-form-horizontal.login-form .k-textbox.k-input.invalid,
::ng-deep .k-form-horizontal.login-form .k-textbox.k-input-solid.invalid {
    border-color: #f31700;
}

::ng-deep .k-dialog .k-window-content .k-form.login-form.k-form-horizontal {
    padding: 32px !important;
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""