Пример #1
0
  @Override
  public String[] changePwd(String user_id, String old_pass, String new_pass) {
    old_pass = StringUtil.isEmpty(old_pass);

    // TODO
    User user = selectByKey(user_id);
    if (null == user) return new String[] {"用户不存在"};

    // TODO
    if (!MD5.encode(old_pass).equals(user.getUser_pass())) return new String[] {"原始密码错误"};

    User _user = new User();
    _user.setId(user_id);
    _user.setUser_pass(MD5.encode(new_pass));
    super.updateNotNull(_user);

    return null;
  }
Пример #2
0
  @Override
  public int save(User user) {
    user.setRole_id("e4acb256cafa4cb487fa6abf508df073");
    user.setUser_pass(MD5.encode(user.getUser_pass()));
    user.setCreate_time(new Date());
    user.setStatus(1);

    user.setApikey(genUserApiKey());
    user.setSeckey(genUserSecKey());

    return super.save(user);
  }