Skip to content
Snippets Groups Projects
Commit 36ffbdd9 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #13695 TIME 01:45 front cas login

parent e9bbc5b5
No related branches found
No related tags found
No related merge requests found
......@@ -6,20 +6,22 @@
<div style="color: white;font-size: 14px;" [innerHTML]="loginMessage | safeHtml"></div>
<p style="color: white;font-size: 14px;font-weight: bold;">{{applicationName}}</p>
<div style="padding-left: 30px;padding-right: 30px;">
<mat-form-field class="input-row login" appearance="outline" style="padding-bottom: 0px;">
<mat-form-field *ngIf="['cas'].indexOf(authService.authMode) === -1" class="input-row login" appearance="outline" style="padding-bottom: 0px;">
<input id="login" name="login" matInput [placeholder]="this.translate.instant('lang.id')" formControlName="login"
type="text">
</mat-form-field>
<mat-form-field class="input-row" appearance="outline">
<mat-form-field *ngIf="['cas'].indexOf(authService.authMode) === -1" class="input-row" appearance="outline">
<input id="password" name="password" matInput [placeholder]="this.translate.instant('lang.password')" type="password"
formControlName="password">
<mat-hint align="end" *ngIf="authService.authMode === 'standard'"><a
routerLink="/forgot-password" class="infoLogin">{{'lang.forgotPassword' | translate}} ?</a></mat-hint>
<mat-hint align="end" *ngIf="authService.authMode !== 'ldap'"><span
<mat-hint align="end" *ngIf="authService.authMode === 'ldap'"><span
class="infoLogin">{{'lang.' + authService.authMode + 'Enabled' | translate}}</span></mat-hint>
</mat-form-field>
</div>
<div *ngIf="['cas'].indexOf(authService.authMode) > -1" class="alert-message alert-message-info" role="alert" style="max-width: 100%;">
{{'lang.' + authService.authMode + 'Enabled' | translate}}
</div>
<button id="submit" type="submit" mat-stroked-button [disabled]="loginForm.invalid || loading"
style="color: white;border-color: #24b0ed;background: #24b0ed;">{{'lang.LOGIN' | translate}}</button>
</form>
......
......@@ -63,13 +63,14 @@ export class LoginComponent implements OnInit {
}
}
onSubmit() {
onSubmit(ssoToken = null) {
this.loading = true;
this.http.post(
'../rest/authenticate',
{
'login': this.loginForm.get('login').value,
'password': this.loginForm.get('password').value
'password': this.loginForm.get('password').value,
'ssoToken' : ssoToken
},
{
observe: 'response'
......@@ -114,10 +115,19 @@ export class LoginComponent implements OnInit {
this.loginMessage = data.loginMessage;
this.authService.setEvent('authenticationInformations');
if (['cas', 'openid'].indexOf(this.authService.authMode) > -1) {
// FOR TEST
this.authService.authMode = 'cas';
this.authService.authUrl = 'https://10.2.95.72:8443/cas-server-webapp-4.0.0/login?service=http://localhost/maarch_courrier_develop/cs_recette/dist/index.html#/login';
if (['cas', 'keycloak'].indexOf(this.authService.authMode) > -1) {
this.loginForm.disable();
this.loginForm.setValidators(null);
this.onSubmit();
const regex = /ticket=[.]*/g;
if (window.location.search.match(regex) !== null) {
this.onSubmit(window.location.search.substring(1, window.location.search.length));
} else {
window.location.href = this.authService.authUrl;
}
}
}),
finalize(() => this.showForm = true),
......
......@@ -12,6 +12,7 @@ import { Observable, Subject } from 'rxjs';
export class AuthService {
authMode: string = 'default';
authUrl: string = '';
changeKey: boolean = null;
user: any = {};
private eventAction = new Subject<any>();
......
......@@ -2092,8 +2092,8 @@
"size": "Taille",
"linkedMails": "Courrier(s) lié(s)",
"ldapEnabled": "Ldap activé",
"openidEnabled": "Openid activé",
"casEnabled": "CAS activé",
"keycloakEnabled": "Authentification Keycloak activée",
"casEnabled": "Authentification CAS activée",
"displayAsTechnicalData" : "Afficher en tant que donnée technique",
"displayInForm" : "Afficher dans le formulaire",
"technicalInformations" : "Informations techniques"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment