コード例 #1
0
  @Override
  @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
  public void update(long userId, EditUser editUserForm) {
    User loggedIn = MyTools.getSessionUser();
    MyTools.validate(loggedIn.getId() == userId, "noPermission");
    User user = userRepo.findOne(userId);
    user.setName(editUserForm.getName());

    userRepo.save(user);
  }
コード例 #2
0
  @Override
  public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
    User user = userRepo.findByEmail(username);
    if (user == null) {
      throw new UsernameNotFoundException(username);
    }

    return new UserDetailsImpl(user);
  }
コード例 #3
0
  @Override
  public User findOne(long userId) {

    User loggedIn = MyTools.getSessionUser();
    User user = userRepo.findOne(userId);
    // if nobody is logged in or if the user is not seeing is own profile
    if (loggedIn == null || loggedIn.getId() != user.getId()) user.setEmail("********");

    return user;
  }
コード例 #4
0
  @Override
  @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
  public void signupForm(SignupForm signupForm) {

    User user = new User();
    user.setEmail(signupForm.getEmail());
    user.setName(signupForm.getFirstname());

    user.setPassword(passwordEncoder.encode(signupForm.getPassword()));
    // user.getRoles().add(Role.);
    // user.setVerificationCode(RandomStringUtils.randomAlphanumeric(16));
    userRepo.save(user);

    /**
     * ******************************************************************** figure out how to create
     * email verification link -put it here String ...
     */
    // //////////////////////////////////////////////////////////////////

  }
コード例 #5
0
  public List<User> findAll() {

    return userRepo.findAll();
  }