From 75dd74324408890f0df20be011e22db9d1fc2ae5 Mon Sep 17 00:00:00 2001 From: Dmitry Nehaychik <4dmitr@gmail.com> Date: Wed, 2 Aug 2017 17:27:19 +0300 Subject: [PATCH] feat(auth): auth pages added --- .angular-cli.json | 3 ++- src/app/@theme/styles/variables.scss | 2 ++ src/app/app-routing.module.ts | 39 +++++++++++++++++++++++++++- src/app/app.module.ts | 16 +++++++++++- src/app/pages/pages-menu.ts | 16 ++++++++++++ src/app/pages/pages.component.ts | 1 - 6 files changed, 73 insertions(+), 4 deletions(-) diff --git a/.angular-cli.json b/.angular-cli.json index 28177326..24fe9dc0 100644 --- a/.angular-cli.json +++ b/.angular-cli.json @@ -24,7 +24,8 @@ "testTsconfig": "tsconfig.spec.json", "styles": [ "../node_modules/ionicons/scss/ionicons.scss", - "../node_modules/font-awesome/scss/font-awesome.scss" + "../node_modules/font-awesome/scss/font-awesome.scss", + "./app/@theme/styles/styles.scss" ], "scripts": [ "../node_modules/tinymce/tinymce.js", diff --git a/src/app/@theme/styles/variables.scss b/src/app/@theme/styles/variables.scss index 14386f67..ab8c334e 100644 --- a/src/app/@theme/styles/variables.scss +++ b/src/app/@theme/styles/variables.scss @@ -3,6 +3,8 @@ // @nebular our of the box themes @import '~@nebular/theme/styles/themes'; +// TODO: rename into themes + // which themes you what to enable (empty to enable all - not recommended) $nb-enabled-themes: (default, light, cosmic); diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 21ea2d51..35429f3a 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,9 +1,46 @@ import { ExtraOptions, RouterModule, Routes } from '@angular/router'; import { NgModule } from '@angular/core'; +import { + NgaAuthComponent, + NgaLoginComponent, + NgaLogoutComponent, + NgaRegisterComponent, + NgaRequestPasswordComponent, + NgaResetPasswordComponent +} from '@akveo/nga-auth'; const routes: Routes = [ - // {path: 'admin'} { path: 'pages', loadChildren: 'app/pages/pages.module#PagesModule' }, + { + path: 'auth', + component: NgaAuthComponent, + children: [ + { + path: '', + component: NgaLoginComponent, + }, + { + path: 'login', + component: NgaLoginComponent, + }, + { + path: 'register', + component: NgaRegisterComponent, + }, + { + path: 'logout', + component: NgaLogoutComponent, + }, + { + path: 'request-password', + component: NgaRequestPasswordComponent, + }, + { + path: 'reset-password', + component: NgaResetPasswordComponent, + }, + ], + }, { path: '', redirectTo: 'pages', pathMatch: 'full' }, { path: '**', redirectTo: 'pages' }, ]; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index d24f2c36..8af3fe71 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -8,7 +8,7 @@ import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { NgModule } from '@angular/core'; import { HttpModule } from '@angular/http'; - +import { NgaAuthModule, NgaDummyAuthProvider } from '@akveo/nga-auth'; import { CoreModule } from './@core/core.module'; import { AppComponent } from './app.component'; @@ -25,6 +25,20 @@ import { ThemeModule } from './@theme/theme.module'; CoreModule, ThemeModule.forRoot(), CoreModule.forRoot(), + NgaAuthModule, + NgaAuthModule.forRoot({ + providers: { + email: { + service: NgaDummyAuthProvider, + config: { + delay: 1000, + login: { + rememberMe: true, + } + }, + }, + } + }), ], bootstrap: [AppComponent], providers: [ diff --git a/src/app/pages/pages-menu.ts b/src/app/pages/pages-menu.ts index 951addc4..3e46c83a 100644 --- a/src/app/pages/pages-menu.ts +++ b/src/app/pages/pages-menu.ts @@ -99,4 +99,20 @@ export const MENU_ITEMS: List = List([{ title: 'Smart Table', link: '/pages/tables/smart-table', }]), +}, { + title: 'Auth', + icon: 'ion-unlocked', + children: List([{ + title: 'Login', + link: '/auth/login', + }, { + title: 'Register', + link: '/auth/register', + }, { + title: 'Request Password', + link: '/auth/request-password', + }, { + title: 'Reset Password', + link: '/auth/reset-password', + }]), }]); diff --git a/src/app/pages/pages.component.ts b/src/app/pages/pages.component.ts index d304406f..9451625a 100644 --- a/src/app/pages/pages.component.ts +++ b/src/app/pages/pages.component.ts @@ -1,6 +1,5 @@ import { Component } from '@angular/core'; -import 'style-loader!../@theme/styles/styles.scss'; import { MENU_ITEMS } from './pages-menu'; @Component({