@Test public void changePassword() { UserIdentityDO userIdentity = setUp1(); userIdentityService.createIdentity(userIdentity); boolean b = userIdentityService.changePassword(userIdentity.getUserId(), "147258"); assertTrue(b); boolean valid = userIdentityService.verifyUsernamePassword(userIdentity.getUserId(), "pedro", "147258"); assertTrue(valid); }
@Override public boolean changePassword(Long userId, String password) { String encrypted = EncryptUtil.encrypt(password); UserIdentityDO userIdentity = UserIdentityDO.builder().credential(encrypted).build(); QueryWrapper<UserIdentityDO> wrapper = new QueryWrapper<>(); wrapper.lambda().eq(UserIdentityDO::getUserId, userId); return this.baseMapper.update(userIdentity, wrapper) > 0; }
UserIdentityServiceImpl extends ServiceImpl<UserIdentityMapper, UserIdentityDO> implements UserIdentityService { @Override public boolean changePassword(Long userId, String password) { String encrypted = EncryptUtil.encrypt(password); UserIdentityDO userIdentity = UserIdentityDO.builder().credential(encrypted).build(); QueryWrapper<UserIdentityDO> wrapper = new QueryWrapper<>(); wrapper.lambda().eq(UserIdentityDO::getUserId, userId); return this.baseMapper.update(userIdentity, wrapper) > 0; } }
UserIdentityServiceImpl extends ServiceImpl<UserIdentityMapper, UserIdentityDO> implements UserIdentityService { @Override public boolean changePassword(Long userId, String password) { String encrypted = EncryptUtil.encrypt(password); UserIdentityDO userIdentity = UserIdentityDO.builder().credential(encrypted).build(); QueryWrapper<UserIdentityDO> wrapper = new QueryWrapper<>(); wrapper.lambda().eq(UserIdentityDO::getUserId, userId); return this.baseMapper.update(userIdentity, wrapper) > 0; }  }
UserIdentityServiceImpl extends ServiceImpl<UserIdentityMapper, UserIdentityDO> implements UserIdentityService { @Override public boolean changePassword(Long userId, String password) { String encrypted = EncryptUtil.encrypt(password); UserIdentityDO userIdentity = UserIdentityDO.builder().credential(encrypted).build(); QueryWrapper<UserIdentityDO> wrapper = new QueryWrapper<>(); wrapper.lambda().eq(UserIdentityDO::getUserId, userId); return this.baseMapper.update(userIdentity, wrapper) > 0; }  @Override UserIdentityDO createIdentity(Long userId, String identityType, String identifier, String credential); @Override UserIdentityDO createIdentity(UserIdentityDO userIdentity); @Override UserIdentityDO createUsernamePasswordIdentity(Long userId, String identifier, String credential); @Override boolean verifyUsernamePassword(Long userId, String username, String password); @Override boolean changePassword(Long userId, String password); @Override boolean changeUsername(Long userId, String username); @Override boolean changeUsernamePassword(Long userId, String username, String password); }
UserIdentityServiceImpl extends ServiceImpl<UserIdentityMapper, UserIdentityDO> implements UserIdentityService { @Override public boolean changePassword(Long userId, String password) { String encrypted = EncryptUtil.encrypt(password); UserIdentityDO userIdentity = UserIdentityDO.builder().credential(encrypted).build(); QueryWrapper<UserIdentityDO> wrapper = new QueryWrapper<>(); wrapper.lambda().eq(UserIdentityDO::getUserId, userId); return this.baseMapper.update(userIdentity, wrapper) > 0; }  @Override UserIdentityDO createIdentity(Long userId, String identityType, String identifier, String credential); @Override UserIdentityDO createIdentity(UserIdentityDO userIdentity); @Override UserIdentityDO createUsernamePasswordIdentity(Long userId, String identifier, String credential); @Override boolean verifyUsernamePassword(Long userId, String username, String password); @Override boolean changePassword(Long userId, String password); @Override boolean changeUsername(Long userId, String username); @Override boolean changeUsernamePassword(Long userId, String username, String password);  }