public void changePassword(User user, String oldPassword, String newPassword) throws TypedSqlException { if (checkAuth(user.name(), oldPassword) == null) { throw new CheckPasswordException(); } changePassword(user, newPassword); }
public void changePassword(User user, String password) throws TypedSqlException { try { db.callInTransaction( () -> db.getDao(User.class).queryForId(user.id()).password(password).save()); } catch (SQLException e) { throw new TypedSqlException(e, TypedSqlException.Type.UNKNOWN); } }