Exemple #1
0
  public final boolean signIn(final String username, final String password) {
    User user = userService.findUserByUserNameAndPassword(username, password);
    if (user != null) {
      signedIn = true;
    }

    if (signedIn) {
      // prevents session fixation attack
      this.replaceSession();

      setUserId(user.getId().toString());
      setUserName(user.getUserName());
      user.setLastLoginTs(new Date());
      userService.save(user);
    }
    return signedIn;
  }
Exemple #2
0
  public final synchronized void addToFavourites(String realStateId, String title) {
    if (this.isTemporary()) {
      bind();
    }

    if (!bookMarkMap.containsKey(realStateId) && title != null) {
      this.getId();
      bookMarkMap.put(realStateId, title);
      if (this.userId != null) {
        userService.saveMarkedItems(realStateId, this.getUserId());
      }
    }
  }