Skip to content

Commit 23dd7cc

Browse files
committed
fixed some bugs in authentication
1 parent 3e172c5 commit 23dd7cc

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

backend/gamelink/src/main/java/urjc/gamelink/Configuration/Security/RestSecurityConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ protected void configure(HttpSecurity http) throws Exception {
4949
http.antMatcher("/api/**");
5050

5151
// URLs that need authentication to access to it
52+
http.authorizeRequests().antMatchers(HttpMethod.GET, "/api/users/").hasAnyRole("ADMIN");
5253
http.authorizeRequests().antMatchers(HttpMethod.POST, "/api/users/").not().hasAnyRole("USERO");
5354
http.authorizeRequests().antMatchers(HttpMethod.POST, "/api/users/**").hasAnyRole("USERO");
5455
http.authorizeRequests().antMatchers(HttpMethod.PUT, "/api/users/**").hasAnyRole("USERO");

frontend/src/app/components/login/login.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export class LoginComponent {
2020

2121
logOut() {
2222
this.loginService.logOut();
23+
this.router.navigate(['/home']);
2324
}
2425

2526
}

frontend/src/app/components/login/signUp.component.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,14 @@ export class SignUpComponent {
1616

1717
event.preventDefault();
1818
const formData = new FormData();
19-
var user: Usero = { nick, name, lastName, email, creditCard: "", image: true, roles: ['USERO']}
2019
formData.append('nick', nick);
2120
formData.append('name', name);
2221
formData.append('lastName', lastName);
2322
formData.append('email', email);
2423
formData.append('password', password);
25-
//this.useroService.createUser(user);
2624
this.useroService.createUser(formData);
2725

28-
// this.router.navigate(['/login']);
26+
2927
}
3028

3129
}

frontend/src/app/components/user/userProfile.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,6 @@ export class UserProfile {
7777

7878
logOut() {
7979
this.loginservice.logOut();
80+
this.router.navigate(['/home']);
8081
}
8182
}

0 commit comments

Comments
 (0)