1 try {
2 con = CHDUtils.getRefConnection("jdbc/umds");
3 PreparedStatement ps = con.prepareStatement("select userID, password from " +
4 "t_users where name = ? and deleted = 0");
5 ps.setString(1, name);
6 ResultSet rs = ps.executeQuery();
7 if (rs.next()) {
8 userID = rs.getString("userID");
9 String pass = rs.getString("password");
10 boolean cert = UMUtils.encodePass(new String(password)).equals(pass);
11 if (cert) {
12 result = findByPrimaryKey(userID);
13 if (result.getStatus() == User.STATUS_DISABLE) result = null;
14 LogAction la = new LogAction("登陆成功", name);
15 TLUtils.getTraceLogMgrLocal().createLog(la);
16 }
17 else {
18 LogAction la = new LogAction("登陆失败,密码错误", name);
19 TLUtils.getTraceLogMgrLocal().createLog(la);
20 }
21 }
22 else {
23 LogAction la = new LogAction("登陆失败,用户名错误", name);
24 TLUtils.getTraceLogMgrLocal().createLog(la);
25 }
26 if (rs != null)
27 rs.close();
28 if (ps != null)
29 ps.close();
30 }