示例#1
0
 public TransactionResult createAccount(String userName, String password) {
   TransactionResult result = new TransactionResult();
   UserInfo newUser = new UserInfo();
   newUser.setUserName(userName);
   newUser.setPassword(password);
   newUser.save(newUser);
   result.withResult("success");
   return result;
 }
示例#2
0
 public TransactionResult login(String userName, String password) {
   TransactionResult result = new TransactionResult();
   UserInfo newUser = new UserInfo();
   UserInfo user = newUser.findUser(userName);
   if (user != null) {
     if (user.getPassword().equals(password)) {
       result.withResult("success");
       result.withMessage("Login success");
     } else {
       result.withResult("fail");
       result.withMessage("Password is not correct.");
     }
   } else {
     result.withResult("fail");
     result.withMessage("UserName is not found");
   }
   return result;
 }