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 class="social-btns">
|
||||||
<div>
|
<div>
|
||||||
<div class="card-form">
|
<div class="card-form">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<i class="material-icons">person</i>
|
<i class="material-icons">person</i> -->
|
||||||
<mat-form-field color="accent">
|
<mat-form-field color="accent">
|
||||||
<input type="text" [(ngModel)]="credential.username" matInput placeholder="Username" />
|
<input type="text" [(ngModel)]="credential.username" matInput placeholder="Username" />
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
<!-- </div>
|
||||||
<div class="form-row">
|
<div class="form-row"> -->
|
||||||
<i class="material-icons">lock_outline</i>
|
<!-- <i class="material-icons">lock_outline</i> -->
|
||||||
<mat-form-field color="accent">
|
<mat-form-field color="accent">
|
||||||
<input type="password" [(ngModel)]="credential.secret" matInput placeholder="Password" />
|
<input type="password" [(ngModel)]="credential.secret" matInput placeholder="Password" />
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
<!-- </div>
|
||||||
</div>
|
</div> -->
|
||||||
<div class="card-footer">
|
<div>
|
||||||
<button mat-button (click)="nativeLogin()">LOGIN</button>
|
<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>
|
||||||
|
</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