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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hamza Touizrat
oser-frontend
Commits
8e6b4197
Commit
8e6b4197
authored
2 years ago
by
Mélissa Aïdli
Browse files
Options
Downloads
Patches
Plain Diff
Changed the route in login according to charter signature
parent
e6eac6d5
Branches
Branches containing commit
No related tags found
1 merge request
!80
New signup
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/core/auth/auth.service.ts
+8
-1
8 additions, 1 deletion
src/app/core/auth/auth.service.ts
src/app/login/login.component.ts
+11
-4
11 additions, 4 deletions
src/app/login/login.component.ts
with
19 additions
and
5 deletions
src/app/core/auth/auth.service.ts
+
8
−
1
View file @
8e6b4197
...
@@ -18,9 +18,10 @@ class StoredToken extends SimpleStoredItem { key = 'oser-cs-user-token'; }
...
@@ -18,9 +18,10 @@ class StoredToken extends SimpleStoredItem { key = 'oser-cs-user-token'; }
})
})
export
class
AuthService
{
export
class
AuthService
{
private
loginUrl
=
environment
.
apiUrl
+
'
auth/get-token/
'
;
private
loginUrl
=
environment
.
+
'
auth/get-token/
'
;
private
resetUrl
=
environment
.
apiUrl
+
'
rest-auth/password/reset/
'
;
private
resetUrl
=
environment
.
apiUrl
+
'
rest-auth/password/reset/
'
;
private
resetConfirmUrl
=
environment
.
apiUrl
+
'
rest-auth/password/reset/confirm/
'
;
private
resetConfirmUrl
=
environment
.
apiUrl
+
'
rest-auth/password/reset/confirm/
'
;
private
mandatorySignatureUrl
=
environment
.
apiUrl
+
''
;
fromGuard
:
boolean
;
fromGuard
:
boolean
;
redirectUrl
:
string
;
redirectUrl
:
string
;
...
@@ -82,6 +83,12 @@ export class AuthService {
...
@@ -82,6 +83,12 @@ export class AuthService {
return
new
HttpHeaders
({
Authorization
:
'
Token
'
+
this
.
getToken
()
});
return
new
HttpHeaders
({
Authorization
:
'
Token
'
+
this
.
getToken
()
});
}
}
checkSignatureCharter
(
email
:
string
)
:
Observable
<
boolean
>
{
return
this
.
http
.
post
<
any
>
(
this
.
mandatorySignatureUrl
,
{
email
:
email
}).
pipe
(
map
(()
=>
true
),
);
}
get
isLoggedIn
():
boolean
{
get
isLoggedIn
():
boolean
{
if
(
this
.
user
.
get
())
{
if
(
this
.
user
.
get
())
{
return
true
;
return
true
;
...
...
This diff is collapsed.
Click to expand it.
src/app/login/login.component.ts
+
11
−
4
View file @
8e6b4197
...
@@ -15,6 +15,7 @@ export class LoginComponent implements OnInit {
...
@@ -15,6 +15,7 @@ export class LoginComponent implements OnInit {
loading
:
boolean
=
false
;
loading
:
boolean
=
false
;
defaultRedirectUrl
:
string
=
'
/membres
'
;
defaultRedirectUrl
:
string
=
'
/membres
'
;
charterUrl
:
string
=
'
inscription/student-charter
'
;
formGroup
:
FormGroup
;
formGroup
:
FormGroup
;
constructor
(
constructor
(
...
@@ -55,9 +56,15 @@ export class LoginComponent implements OnInit {
...
@@ -55,9 +56,15 @@ export class LoginComponent implements OnInit {
// Only continue if no error
// Only continue if no error
filter
(
Boolean
),
filter
(
Boolean
),
// Get redirect URL from the auth service, provided by the auth guard.
// Get redirect URL from the auth service, provided by the auth guard.
map
(()
=>
this
.
auth
.
redirectUrl
?
this
.
auth
.
redirectUrl
:
this
.
defaultRedirectUrl
),
map
(()
=>
{
if
(
this
.
auth
.
checkSignatureCharter
)
{
this
.
auth
.
redirectUrl
?
this
.
auth
.
redirectUrl
:
this
.
defaultRedirectUrl
}
else
{
this
.
auth
.
redirectUrl
?
this
.
auth
.
redirectUrl
:
this
.
charterUrl
}
}),
tap
(()
=>
this
.
snackBar
.
open
(
'
Connexion réussie !
'
,
'
OK
'
,
{
duration
:
2000
})),
tap
(()
=>
this
.
snackBar
.
open
(
'
Connexion réussie !
'
,
'
OK
'
,
{
duration
:
2000
})),
tap
((
redirectUrl
:
string
)
=>
this
.
router
.
navigate
([
redirectUrl
])),
).
subscribe
();
).
subscribe
();
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment