implement registration validity checks
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,31 +1,15 @@
|
||||
package wtf.beatrice.releasehive.services;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import wtf.beatrice.releasehive.models.User;
|
||||
import wtf.beatrice.releasehive.repositories.UserRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class UserService
|
||||
public interface UserService
|
||||
{
|
||||
private final UserRepository userRepository;
|
||||
List<User> getAllUsers();
|
||||
|
||||
public UserService(@Autowired UserRepository userRepository) {
|
||||
this.userRepository = userRepository;
|
||||
}
|
||||
User loadUserByUsername(String username) throws UsernameNotFoundException;
|
||||
|
||||
public List<User> getAllUsers() {
|
||||
return userRepository.findAll();
|
||||
}
|
||||
|
||||
public User loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
return userRepository.findByUsername(username).orElseThrow(() -> new UsernameNotFoundException(username));
|
||||
}
|
||||
|
||||
public User loadUserByEmail(String email) throws UsernameNotFoundException {
|
||||
return userRepository.findByEmail(email).orElseThrow(() -> new UsernameNotFoundException(email));
|
||||
}
|
||||
User loadUserByEmail(String email) throws UsernameNotFoundException;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user