/** 登录验证 */ public boolean login(String account, String password) { UserInfo user = userDao.findUserByAccount(account); if (user != null) { if (user.getAccount().equals(account) && user.getPassword().equals(password)) { return true; } else { return false; } } else { return false; } }
/** 用户注册 */ public boolean register(String... strings) { String nickname = strings[0]; String account = strings[1]; String pwd = strings[2]; String rank = strings[3]; String userInfo = strings[4]; UserInfo u = new UserInfo(); u.setNickname(nickname); u.setAccount(account); u.setPassword(pwd); u.setRanks(rank); u.setUserInfo(userInfo); try { userDao.insertUserInfo(u); return true; } catch (Exception e) { return false; } }