瀏覽代碼

Roles not being set upon signup

JaseG256 6 年之前
父節點
當前提交
c2c537ee32
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4
    4
      ZipTeamOrange-server/src/main/java/ZipTeamOrange/controller/AuthController.java

+ 4
- 4
ZipTeamOrange-server/src/main/java/ZipTeamOrange/controller/AuthController.java 查看文件

@@ -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