admin login page
This commit is contained in:
parent
54779bf53f
commit
326e5e0356
|
@ -88,6 +88,13 @@ const appRoutes: Routes = [
|
||||||
breadcrumb: true
|
breadcrumb: true
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'login/admin',
|
||||||
|
loadChildren: './ui/auth/admin-login/admin-login.module#AdminLoginModule',
|
||||||
|
data: {
|
||||||
|
breadcrumb: true
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'login',
|
path: 'login',
|
||||||
loadChildren: './ui/auth/login/login.module#LoginModule',
|
loadChildren: './ui/auth/login/login.module#LoginModule',
|
||||||
|
|
|
@ -11,6 +11,7 @@ import { BaseService } from '../../common/base/base.service';
|
||||||
import { Credential } from '../../model/auth/credential';
|
import { Credential } from '../../model/auth/credential';
|
||||||
import { LoginInfo } from '../../model/auth/login-info';
|
import { LoginInfo } from '../../model/auth/login-info';
|
||||||
import { Principal } from '../../model/auth/Principal';
|
import { Principal } from '../../model/auth/Principal';
|
||||||
|
import { UiNotificationService, SnackBarNotificationLevel } from '../notification/ui-notification-service';
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@ -20,9 +21,10 @@ export class AuthService extends BaseService {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private http: HttpClient,
|
private http: HttpClient,
|
||||||
public snackBar: MatSnackBar,
|
private snackBar: MatSnackBar,
|
||||||
public language: TranslateService,
|
private language: TranslateService,
|
||||||
public router: Router
|
private router: Router,
|
||||||
|
private uiNotificationService: UiNotificationService
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.actionUrl = environment.Server + 'auth/';
|
this.actionUrl = environment.Server + 'auth/';
|
||||||
|
@ -133,18 +135,12 @@ export class AuthService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public onLogOutSuccess(logoutMessage: any) {
|
public onLogOutSuccess(logoutMessage: any) {
|
||||||
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
|
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-LOGOUT'), SnackBarNotificationLevel.Success);
|
||||||
data: { message: 'GENERAL.SNACK-BAR.SUCCESSFUL-LOGOUT', language: this.language },
|
|
||||||
duration: 3000,
|
|
||||||
});
|
|
||||||
this.router.navigate(['/login']);
|
this.router.navigate(['/login']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public onLogOutError(errorMessage: string) {
|
public onLogOutError(errorMessage: string) {
|
||||||
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
|
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-LOGOUT'), SnackBarNotificationLevel.Error);
|
||||||
data: { message: 'GENERAL.SNACK-BAR.UNSUCCESSFUL-LOGOUT', language: this.language },
|
|
||||||
duration: 3000,
|
|
||||||
});
|
|
||||||
this.router.navigate(['/login']);
|
this.router.navigate(['/login']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,31 +4,31 @@
|
||||||
<div class="row col-md-6 col-sm-6 col-md-offset-3 col-sm-offset-3">
|
<div class="row col-md-6 col-sm-6 col-md-offset-3 col-sm-offset-3">
|
||||||
<div class="card col-md-8 col-md-offset-2">
|
<div class="card col-md-8 col-md-offset-2">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h4>Login</h4>
|
<h4>Admin Login</h4>
|
||||||
<div class="social-btns">
|
</div>
|
||||||
<div>
|
<!-- <div class="social-btns">
|
||||||
<div class="card-form">
|
<div>
|
||||||
<div class="form-row">
|
<div class="card-form">
|
||||||
<i class="material-icons">person</i>
|
<div class="form-row">
|
||||||
<mat-form-field color="accent">
|
<i class="material-icons">person</i> -->
|
||||||
<input type="text" [(ngModel)]="credential.username" matInput placeholder="Username" />
|
<mat-form-field color="accent">
|
||||||
</mat-form-field>
|
<input type="text" [(ngModel)]="credential.username" matInput placeholder="Username" />
|
||||||
</div>
|
</mat-form-field>
|
||||||
<div class="form-row">
|
<!-- </div>
|
||||||
<i class="material-icons">lock_outline</i>
|
<div class="form-row"> -->
|
||||||
<mat-form-field color="accent">
|
<!-- <i class="material-icons">lock_outline</i> -->
|
||||||
<input type="password" [(ngModel)]="credential.secret" matInput placeholder="Password" />
|
<mat-form-field color="accent">
|
||||||
</mat-form-field>
|
<input type="password" [(ngModel)]="credential.secret" matInput placeholder="Password" />
|
||||||
</div>
|
</mat-form-field>
|
||||||
</div>
|
<!-- </div>
|
||||||
<div class="card-footer">
|
</div> -->
|
||||||
<button mat-button (click)="nativeLogin()">LOGIN</button>
|
<div>
|
||||||
</div>
|
<button mat-raised-button color="primary" (click)="nativeLogin()">LOGIN</button>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- </div>
|
||||||
|
</div> -->
|
||||||
|
|
|
@ -29,6 +29,10 @@ export class AdminLoginComponent extends BaseComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.credential = {
|
||||||
|
username: null,
|
||||||
|
secret: null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public nativeLogin() {
|
public nativeLogin() {
|
||||||
|
|
Loading…
Reference in New Issue