better exception messages
This commit is contained in:
parent
2feadc12b5
commit
2533442cae
@ -761,7 +761,7 @@ public class Controller {
|
|||||||
User invitedUser = userRepository.findByEmail(invitedUserEmail);
|
User invitedUser = userRepository.findByEmail(invitedUserEmail);
|
||||||
|
|
||||||
if (invitedUser == null) {
|
if (invitedUser == null) {
|
||||||
return ResponseEntity.status(404).body("There isnt any user with that email");
|
return ResponseEntity.status(404).body("Es gibt keinen Benutzer mit dieser email.");
|
||||||
}
|
}
|
||||||
//----------------------
|
//----------------------
|
||||||
|
|
||||||
@ -770,7 +770,7 @@ public class Controller {
|
|||||||
User_Info user_info = user_infoRepository.findUser_InfoByUser(user);
|
User_Info user_info = user_infoRepository.findUser_InfoByUser(user);
|
||||||
//----------------------
|
//----------------------
|
||||||
if (user_info.getTeam() == null) {
|
if (user_info.getTeam() == null) {
|
||||||
return ResponseEntity.status(400).body("You aren´t in any team");
|
return ResponseEntity.status(400).body("Du bist derzeit in keinem Team und kannst deshalb keine Teameinladungen versenden.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get team
|
//Get team
|
||||||
@ -783,7 +783,7 @@ public class Controller {
|
|||||||
Team team = (Team) getTeam.getBody();
|
Team team = (Team) getTeam.getBody();
|
||||||
|
|
||||||
if (teamInviteRepository.findByUserAndTeam(invitedUser, team) != null) {
|
if (teamInviteRepository.findByUserAndTeam(invitedUser, team) != null) {
|
||||||
return ResponseEntity.status(400).body("The user is already invited to this team");
|
return ResponseEntity.status(400).body("Der Benutzer ist bereits in das Team eingeladen.");
|
||||||
}
|
}
|
||||||
|
|
||||||
TeamInvite teamInvite = new TeamInvite();
|
TeamInvite teamInvite = new TeamInvite();
|
||||||
@ -906,7 +906,7 @@ public class Controller {
|
|||||||
User_Info user_info = user_infoRepository.findUser_InfoByUser(user);
|
User_Info user_info = user_infoRepository.findUser_InfoByUser(user);
|
||||||
//----------------------
|
//----------------------
|
||||||
if (user_info.getTeam() == null) {
|
if (user_info.getTeam() == null) {
|
||||||
return ResponseEntity.status(400).body("You aren´t in any team");
|
return ResponseEntity.status(400).body("Du kannst einen Teamstatus nur setzen, wenn du in einem Team bist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get team
|
//Get team
|
||||||
|
|||||||
@ -19,7 +19,7 @@ public class VerificationUtil {
|
|||||||
|
|
||||||
private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(VerificationUtil.class);
|
private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(VerificationUtil.class);
|
||||||
|
|
||||||
public static void fetchPublicKey(){
|
public static void fetchPublicKey() {
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
try {
|
try {
|
||||||
logger.warn("POST CONSCTRUCT: FETCH PUBLIC KEY");
|
logger.warn("POST CONSCTRUCT: FETCH PUBLIC KEY");
|
||||||
@ -41,9 +41,9 @@ public class VerificationUtil {
|
|||||||
//Fehler muss zurückgegeben werden
|
//Fehler muss zurückgegeben werden
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResponseEntity verifyToken(String token){
|
public static ResponseEntity verifyToken(String token) {
|
||||||
|
|
||||||
try{
|
try {
|
||||||
|
|
||||||
logger.warn("VERIFY TOKEN: token: " + token);
|
logger.warn("VERIFY TOKEN: token: " + token);
|
||||||
Claims claims = Jwts.parser() //Parse JWT
|
Claims claims = Jwts.parser() //Parse JWT
|
||||||
@ -53,12 +53,12 @@ public class VerificationUtil {
|
|||||||
logger.debug("VERIFY TOKEN: Got Claims: " + claims);
|
logger.debug("VERIFY TOKEN: Got Claims: " + claims);
|
||||||
|
|
||||||
return ResponseEntity.status(200).body(claims);
|
return ResponseEntity.status(200).body(claims);
|
||||||
} catch (ExpiredJwtException e){
|
} catch (ExpiredJwtException e) {
|
||||||
logger.debug("VERIFY TOKEN: JWT Token expired");
|
logger.debug("VERIFY TOKEN: JWT Token expired");
|
||||||
return ResponseEntity.status(401).body("JWT Token expired");
|
return ResponseEntity.status(401).body("Bitte loggen sie sich erneut ein.");
|
||||||
} catch (Exception e){
|
} catch (Exception e) {
|
||||||
logger.debug("VERIFY TOKEN: Something went wrong verificating");
|
logger.debug("VERIFY TOKEN: Something went wrong verificating");
|
||||||
return ResponseEntity.status(400).body("Something went wrong");
|
return ResponseEntity.status(401).body("Bitte loggen sie sich erneut ein.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user