I have a part of code what i want to upgrade.
request.getLastName(),
request.getEmail(),
request.getPassword(),
AppUserRole.USER
)
);
String link = "http://localhost:8080/api/v1/registration/confirm?token=" + token;
emailSender.send(
request.getEmail(),
buildEmail(request.getFirstName(), link));
return token;
}
I want to create if, for giving a role ADMIN, I've tried to add if inside the appUserService and outside of it with another appUserService like downside, but its always give me an error. When String token = appUserService.signUpUser inside the if, it says that token is not defined in the String link... part of code. I want that it will be like that
if (request.getEmail() == "admins.mail@gmail.com") {
String token = appUserService.signUpUser(new AppUser(request.getFirstName(), request.getLastName(), request.getEmail(), request.getPassword(), AppUserRole.ADMIN));
} else {
String token = appUserService.signUpUser(new AppUser(request.getFirstName(), request.getLastName(), request.getEmail(), request.getPassword(), AppUserRole.USER));
}
Write me please how it must be to work properly.