Skip to content

Commit c5f2359

Browse files
committed
fix minor bug
1 parent f62b567 commit c5f2359

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

server/src/main/java/dev/findfirst/security/oauth2client/OauthUserService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2Authentic
6060
return signupUser(username, oauth2PlaceholderEmail);
6161
}
6262
} catch (UnexpectedException | UserNameTakenException | EmailAlreadyRegisteredException e) {
63-
throw new RuntimeException(e.getMessage());
64-
// no-op just return null;
63+
throw new RuntimeException("signup failed", e);
6564
}
6665
};
6766

@@ -80,7 +79,8 @@ else if (username != null && !username.isEmpty()) {
8079
throw new RuntimeException("Error with user signup/signin");
8180
}
8281

83-
int userRole = user.getRole().getId() != null ? user.getUserId() : 0;
82+
Integer roleId = user.getRole().getId();
83+
int userRole = roleId != null ? roleId : 0;
8484

8585
GrantedAuthority authority = new SimpleGrantedAuthority(URole.values()[userRole].toString());
8686
String userNameAttributeName = userRequest.getClientRegistration().getProviderDetails()

0 commit comments

Comments
 (0)