class UserService {

	public Optional<User> requestPasswordReset(final String mail) {
		return userRepository.findOneByEmail(mail).filter(user -> user.getActivated() == true).map(user -> {
			user.setResetKey(RandomUtil.generateResetKey());
			user.setResetDate(DateTime.now());
			userRepository.save(user);
			return user;
		});
	}

}