Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
oser-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hamza Touizrat
oser-frontend
Merge requests
!81
add
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
add
new_signup
into
master
Overview
0
Commits
1
Pipelines
0
Changes
2
Merged
Hamza Touizrat
requested to merge
new_signup
into
master
2 years ago
Overview
0
Commits
1
Pipelines
0
Changes
2
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
be8fc32c
1 commit,
2 years ago
2 files
+
30
−
44
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
src/app/login/login.component.ts
+
28
−
42
View file @ be8fc32c
Edit in single-file editor
Open in Web IDE
Show full file
@@ -18,7 +18,7 @@ export class LoginComponent implements OnInit {
defaultRedirectUrl
:
string
=
'
/membres
'
;
charterUrl
:
string
=
'
inscription/student-charter
'
;
formGroup
:
FormGroup
;
loginSuccess
:
boolean
=
fals
e
;
loginSuccess
:
boolean
=
tru
e
;
constructor
(
private
router
:
Router
,
@@ -50,53 +50,39 @@ export class LoginComponent implements OnInit {
this
.
loading
=
true
;
const
{
email
,
password
}
=
this
.
formGroup
.
value
;
this
.
messageService
.
clear
();
await
this
.
auth
.
login
(
email
,
password
).
pipe
(
map
(()
=>
this
.
loginSuccess
=
true
),
await
this
.
auth
.
checkSignatureCharter
(
email
).
pipe
(
catchError
(()
=>
{
this
.
messageService
.
error
(
"
L'identifiant ou le mot de passe est incorrect.
"
);
this
.
loginSuccess
=
false
;
this
.
hassignedCharter
=
false
;
return
of
(
false
);
}),
t
ap
(()
=>
this
.
lo
ading
=
fals
e
),
m
ap
(()
=>
this
.
lo
ginSuccess
=
tru
e
),
// Only continue if no error
filter
(
Boolean
),
// Get redirect URL from the auth service, provided by the auth guard.
).
toPromise
();
).
subscribe
({
complete
()
{
console
.
log
(
"
login unsuccess
"
);
},
});
await
this
.
auth
.
login
(
email
,
password
).
toPromise
().
catch
(()
=>
{
console
.
log
(
"
this.loginSuccess)
"
);
this
.
messageService
.
error
(
"
L'identifiant ou le mot de passe est incorrect.
"
);
tap
(()
=>
this
.
snackBar
.
open
(
"
L'identifiant ou le mot de passe est incorrect.
"
,
'
OK
'
,
{
duration
:
2000
})),
if
(
this
.
loginSuccess
==
true
){
this
.
auth
.
checkSignatureCharter
(
email
).
pipe
(
catchError
(()
=>
{
this
.
hassignedCharter
=
false
;
this
.
loginSuccess
=
false
;
this
.
loading
=
false
;
return
of
(
false
);
});
this
.
messageService
.
error
(
"
Vous n'avez pas signé le(s) charte(s).
"
);
map
(()
=>
this
.
auth
.
redirectUrl
?
this
.
auth
.
redirectUrl
:
this
.
defaultRedirectUrl
),
tap
((
redirectUrl
:
string
)
=>
this
.
router
.
navigate
([
redirectUrl
]));
return
of
(
false
);
}),
map
(()
=>
this
.
auth
.
redirectUrl
?
this
.
auth
.
redirectUrl
:
this
.
defaultRedirectUrl
),
tap
(()
=>
this
.
snackBar
.
open
(
'
Connexion réussie !
'
,
'
OK
'
,
{
duration
:
2000
})),
).
subscribe
().
add
(()
=>
{
if
(
this
.
hassignedCharter
==
false
)
{
this
.
router
.
navigate
([
this
.
charterUrl
]);
}
else
{
this
.
router
.
navigate
([
this
.
defaultRedirectUrl
]);
}
});
}
if
(
this
.
loginSuccess
)
{
}
}
\ No newline at end of file
this
.
loading
=
false
;
console
.
log
(
this
.
loginSuccess
);
if
(
this
.
hassignedCharter
==
false
)
{
this
.
router
.
navigate
([
this
.
charterUrl
]);
}
else
{
this
.
router
.
navigate
([
this
.
defaultRedirectUrl
]);
}
}
}}
\ No newline at end of file
Loading