Sfoglia il codice sorgente

Roles not being set upon signup

JaseG256 6 anni fa
parent
commit
c2c537ee32

+ 4
- 4
ZipTeamOrange-server/src/main/java/ZipTeamOrange/controller/AuthController.java Vedi File

@@ -82,10 +82,10 @@ public class AuthController {
82 82
 
83 83
         user.setPassword(passwordEncoder.encode(user.getPassword()));
84 84
 
85
-//        Role userRole = roleRepository.findByName(RoleName.ROLE_USER)
86
-//                .orElseThrow(() -> new AppException("User Role not set."));
87
-//
88
-//        user.setRoles(Collections.singleton(userRole));
85
+        Role userRole = roleRepository.findByName(RoleName.ROLE_USER)
86
+                .orElseThrow(() -> new AppException("User Role not set."));
87
+
88
+        user.setRoles(Collections.singleton(userRole));
89 89
 
90 90
         User result = userRepository.save(user);
91 91