### File

`projects/app-base-library/src/lib/angular/components/login/login.component.ts`

### Metadata

selector | `ab-login`
templateUrl | `./login.component.html`

### Index

###### Properties

- Public config
- Public options

###### Methods

- Public login
- Public logout
- ngOnInit
- Public openLoginModal

###### Inputs

- translateService

### Constructor

`constructor(router: Router, config: ConfigService, authService: AuthenticationService)`
Defined in projects/app-base-library/src/lib/angular/components/login/login.component.ts:12

Parameters :

Name | Type | Optional
router | `Router` | no
config | `ConfigService` | no
authService | `AuthenticationService` | no

### Inputs

`translateService` | Type: `any`
Defined in projects/app-base-library/src/lib/angular/components/login/login.component.ts:11

### Methods

Public login
`login()`
Defined in projects/app-base-library/src/lib/angular/components/login/login.component.ts:49
Returns : `void`

Public logout
`logout()`
Defined in projects/app-base-library/src/lib/angular/components/login/login.component.ts:57
Returns : `void`

ngOnInit
`ngOnInit()`
Defined in projects/app-base-library/src/lib/angular/components/login/login.component.ts:17
Returns : `void`

Public openLoginModal
`openLoginModal()`
Defined in projects/app-base-library/src/lib/angular/components/login/login.component.ts:44
Returns : `void`

### Properties

Public config
`config: `ConfigService``
Type : `ConfigService`
Defined in projects/app-base-library/src/lib/angular/components/login/login.component.ts:14

Public options
`options: `any``
Type : `any`
Defined in projects/app-base-library/src/lib/angular/components/login/login.component.ts:12

    import {Component, Input} from '@angular/core';
    import {Router} from '@angular/router';
    import {AuthenticationService} from '../../services/authentication/authentication.service';
    import {ConfigService} from '../../services/config.service';

    @Component({
        selector: 'ab-login',
        templateUrl: './login.component.html'
    })
    export class LoginComponent {
        @Input() translateService: any;
        public options: any;

        constructor(private router: Router, public config: ConfigService, private authService: AuthenticationService) {
        }

        ngOnInit() {
            this.options = {
                authenticated: false,
                context: this,
                // accessTokenId: 'app:localhost:3000:accesToken',
                // refreshTokenId: 'app:localhost:3000:refreshToken',
                // refreshTokenUrl: `http://localhost:3000/refresh`,
                // loginUrl: `http://localhost:3000/login`,
                loginHandler: this.login,
                logoutHandler: this.logout,
                // <!--[translateService]="options.translateService"-->
                // nameRegex]:"option.nameRegex";
                // passwordRegex:"option.passwordRegex"-->
                // nameLabel:"option.nameLabel"
                // <!--[passwordLabel]:"'PASSWORD'"-->
                // <!--[submitLabel]:"'LOGIN'"-->
                // <!--[nameError]:"'REQUIRED'"-->
                // <!--[passwordError]:"'PASSWORD REQUIRED'"-->
                // <!--[submitError]:"option.submitError"-->
                // <!--(login)="option.loginHandler.call(options.context,$event)">-->
            };
            Object.keys(this.config.get('authConfig')).forEach((k, i) => {
                this.options[k] = this.config.get('authConfig')[k];
            });
            this.authService.init(this.options);
        }

        public openLoginModal() {
            // console.log('todo: openLoginModal');
            this.config.services.appService.openLoginModal();
        }

        public login() {
            console.log(localStorage)
            let credentials = {};
            this.authService
                .login()
                .subscribe(() => this.router.navigateByUrl('/'));
        }

        public logout() {
            console.log(localStorage)
        }

    }

    <ab-login-button [authenticated]="config.get('authenticated')" (click)="openLoginModal()"></ab-login-button>

    <div class="padding margin-top">

        <div class="pull-right">
            <p>
                Public area!
            </p>

            <button (click)="login()">
                Login auth
            </button>

        </div>

        <!--<ab-login-form class="card panel container padding"-->
                        <!--(login)="options.loginHandler.call(options.context,$event)">-->
            <!--<h5 class="text-center">{{ config.services.translateService.instant('LOGIN') }}</h5>-->
            <!--&lt;!&ndash;<h5 class="text-center">{{ 'LOGIN' | translate }}</h5>&ndash;&gt;-->
        <!--</ab-login-form>-->

        <!--<ab-login-form class="card panel container padding"-->
                       <!--[translateService]="config.services.translateService"-->
                       <!--(login)="options.loginHandler.call(options.context,$event)">-->
            <!--<h5 class="text-center">{{ config.services.translateService.instant('LOGIN') }}</h5>-->
            <!--&lt;!&ndash;<h5 class="text-center">{{ 'LOGIN' | translate }}</h5>&ndash;&gt;-->
        <!--</ab-login-form>-->

    </div>

    <!--<ab-login-form *ngIf="!options.authenticated"-->
                   <!--[translateService]="options.translateService"-->
                   <!--[nameRegex]="options.nameRegex"-->
                   <!--[passwordRegex]="options.passwordRegex"-->
                   <!--[nameLabel]="options.nameLabel"-->
                   <!--[passwordLabel]="'PASSWORD'"-->
                   <!--[submitLabel]="'LOGIN'"-->
                   <!--[nameError]="'REQUIRED'"-->
                   <!--[passwordError]="'PASSWORD REQUIRED'"-->
                   <!--[submitError]="options.submitError"-->
                   <!--(login)="options.loginHandler.call(options.context,$event)">-->
    <!--</ab-login-form>-->

    <!--<form *ngIf="options.authenticated">-->
      <!--<button type="submit" (click)="options.logoutHandler($event)" class="btn btn-default">{{ 'LOGOUT' | translate }}</button>-->
    <!--</form>-->

Legend
Html element
Component
Html element with directive

# results matching ""

# No results matching ""