public void writePassword(CmsDbContext dbc, String userFqn, String oldPassword, String newPassword)
    throws CmsDataAccessException, CmsPasswordEncryptionException {

        PreparedStatement stmt = null;
        Connection conn = null;

        // check if the old password is valid
        if (oldPassword != null) {
            readUser(dbc, userFqn, oldPassword, "");
        }
        String pwd = newPassword;
        if (dbc.getRequestContext().getAttribute(REQ_ATTR_DONT_DIGEST_PASSWORD) == null) {
            pwd = OpenCms.getPasswordHandler().digest(newPassword);
        }

        try {
            conn = getSqlManager().getConnection(dbc);
            stmt = m_sqlManager.getPreparedStatement(conn, "C_USERS_SET_PWD_3");
            stmt.setString(1, pwd);
            stmt.setString(2, CmsOrganizationalUnit.getSimpleName(userFqn));
            stmt.setString(3, CmsOrganizationalUnit.SEPARATOR + CmsOrganizationalUnit.getParentFqn(userFqn));
            stmt.executeUpdate();
        } catch (SQLException e) {
            throw new CmsDbSqlException(
                Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
                e);
        } finally {
            m_sqlManager.closeAll(dbc, conn, stmt, null);
        }
    }
public void writePassword ( CmsDbContext dbc , String userFqn , String oldPassword , String newPassword ) throws CmsDataAccessException , CmsPasswordEncryptionException { PreparedStatement stmt = null ; Connection conn = null ; if ( oldPassword != null ) { readUser ( dbc , userFqn , oldPassword , "" ) ; } String pwd = newPassword ; if ( dbc . getRequestContext ( ) . getAttribute ( REQ_ATTR_DONT_DIGEST_PASSWORD ) == null ) { pwd = OpenCms . getPasswordHandler ( ) . digest ( newPassword ) ; } try { conn = getSqlManager ( ) . getConnection ( dbc ) ; stmt = m_sqlManager . getPreparedStatement ( conn , "C_USERS_SET_PWD_3" ) ; stmt . setString ( 1 , pwd ) ; stmt . setString ( 2 , CmsOrganizationalUnit . getSimpleName ( userFqn ) ) ; stmt . setString ( 3 , CmsOrganizationalUnit . SEPARATOR + CmsOrganizationalUnit . getParentFqn ( userFqn ) ) ; stmt . executeUpdate ( ) ; } catch ( SQLException e ) { throw new CmsDbSqlException ( Messages . get ( ) . container ( Messages . ERR_GENERIC_SQL_1 , CmsDbSqlException . getErrorQuery ( stmt ) ) , e ) ; } finally { m_sqlManager . closeAll ( dbc , conn , stmt , null ) ; } }
@see org.opencms.db.I_CmsUserDriver#writePassword(org.opencms.db.CmsDbContext, java.lang.String, java.lang.String, java.lang.String)