gogogo119

tt

 

 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         }

posted on 2009-08-14 13:48 消防员 阅读(64) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 

My Links

Blog Stats

常用链接

留言簿

随笔档案

文章档案

搜索

最新评论

阅读排行榜

评论排行榜