1.0.24 • Published 7 years ago

authmodule-angular6-module-example v1.0.24

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

CONFIGURATION

########## Import in app.module.ts

import { AuthenticationModule } from 'authmodule-angular6-module-example';

@NgModule({
    ...
    imports: [
        AuthenticationModule.forRoot({
            apiUrl: 'http://localhost:3000', # API Url
            loginEndpoint: 'users'  # [users or admin] endPoint in Loopback (for http://localhost:3000/users/login),
            createAccount: 'register', # route for register page *optional
            loginAccount: 'login' #route for login page *optional
        })
    ]
    ...
})

########## To use in a component:

import { AuthenticationService } from 'authmodule-angular6-module-example';
...
constructor(private authenticationService: AuthenticationService) {
    console.log('from authenticationService', this.authenticationService.isAuthenticated());
}

########## Exposed Methods

isAuthenticated() : Returns a boolean with the isLoggedIn value.

login(values: CredentialsInterface): Receive a credentials interface (email: string and password: string) and 
    if is a login success set the token and isLoggedIn in localstorage and variable isLoggedIn as true.

logout(): void: Remove token and isLoggedIn from localStorage and the variable isLoggedIn set to false.

########## Component Selectors

auth-app-login

        @Output()
        submit: EventEmitter<any> = new EventEmitter();

auth-app-register

        @Output()
        submit: EventEmitter<any> = new EventEmitter();

auth-app-change-password

        @Output()
        submit: EventEmitter<any> = new EventEmitter();
1.0.24

7 years ago

1.0.23

7 years ago

1.0.22

7 years ago

1.0.21

7 years ago

1.0.20

7 years ago

1.0.19

7 years ago

1.0.18

7 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago