1
0
forked from PGL/Clyde

moved UserWithouPaswword to authenticatorService

This commit is contained in:
2024-03-17 02:40:05 +01:00
parent c5d7ce4178
commit 1d793cef4e
2 changed files with 25 additions and 24 deletions

View File

@@ -7,6 +7,7 @@ import ovh.herisson.Clyde.Tables.Token;
import ovh.herisson.Clyde.Tables.User;
import java.util.Date;
import java.util.HashMap;
@Service
public class AuthenticatorService {
@@ -52,5 +53,25 @@ public class AuthenticatorService {
}
return true;
}
/** return user's data except password
* @param user the user to return
* @return all the user data without the password
*/
public HashMap<String,Object> userWithoutPassword(User user){
HashMap<String,Object> toReturn = new HashMap<>();
toReturn.put("regNo",user.getRegNo());
toReturn.put("lastName",user.getLastName());
toReturn.put("firstName",user.getFirstName());
toReturn.put("email", user.getEmail());
toReturn.put("address",user.getAddress());
toReturn.put("birthDate",user.getBirthDate());
toReturn.put("country",user.getCountry());
toReturn.put("profilePictureUrl",user.getProfilePictureUrl());
toReturn.put("role",user.getRole());
return toReturn;
}
}