Esempio n. 1
0
 @PostConstruct
 public void initialize() {
   logger = Logger.getLogger(KmsSession.class);
   dao = new KmsUserDao();
   if (null == dao.findByNameAndPassword(kmsUserName, kmsPassword)) {
     String userId = KmsPrimaryKey.USER + System.currentTimeMillis();
     try {
       dao.create(new KmsUser(userId, kmsUserName, kmsPassword));
     } catch (Exception e) {
       logger.error("create rvcndev failed");
     }
   }
 }
Esempio n. 2
0
  public String login() {
    // TODO validate user data.
    kmsUser = dao.findByNameAndPassword(kmsUserName, kmsPassword);

    if (kmsUser == null) {
      return null;
    }

    Map<String, Object> sessions =
        FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
    sessions.put("kmsUser", kmsUser);
    return "kmsArticle_list";
  }