Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added rating macro
Wiki Markup
{rate}
If you lost superuser password and are unable log in, use this procedure to reset the account back to its default settings.

...



# Stop Magnolia CMS.

...


# Copy the following JSP script and save it to your {{docroot}} folder, for example {{<apache-tomcat>/webapps/magnoliaAuthor/docroot/recovery-script.jsp}}.

...


{code

...

:xml

...

}
<%@ page contentType="text/plain" %>
<%@ page import="info.magnolia.importexport.BootstrapUtil"%>
<%@ page import="info.magnolia.context.*"%>
<%@ page import="info.magnolia.cms.util.ContentUtil"%>
<%@ page import="info.magnolia.cms.core.HierarchyManager"%>
<%@ page import="javax.jcr.Node"%>
<%@ page import="javax.jcr.ImportUUIDBehavior"%>
<%
info.magnolia.context.MgnlContext.setInstance(new info.magnolia.context.SingleJCRSessionSystemContext());
try{
  BootstrapUtil.bootstrap(new String[]{"/mgnl-bootstrap/core/users.system.superuser.xml"}, 
    ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING);
  HierarchyManager hm = MgnlContext.getHierarchyManager("users");
  hm.save();
  } catch (Exception e) {
  System.out.println(e);
  }
  System.out.println("finished");
%>

...


{code}
# Open {{<apache-tomcat>/webapps/magnoliaAuthor/WEB-INF/web.xml}} in a text editor.

...


# Add the following servlet mapping after the {{<distributable/>}} node.

...


{code

...

:xml

...

}
<servlet-mapping>
  <servlet-name>jsp</servlet-name>
  <url-pattern>/docroot/recovery-script.jsp</url-pattern>
</servlet-mapping>

...


{code}
# Comment out the {{<filter>}} and {{<filter-mapping>}} sections.

...


{code

...

:xml

...

}
<!-- filter>
  <display-name>Magnolia global filters</display-name>
  <filter-name>magnoliaFilterChain</filter-name>
  <filter-class>info.magnolia.cms.filters.MgnlMainFilter</filter-class>
</filter>
<filter-mapping>
  <filter-name>magnoliaFilterChain</filter-name>
  <url-pattern>/*</url-pattern>
  <dispatcher>REQUEST</dispatcher>
  <dispatcher>FORWARD</dispatcher>
  <dispatcher>INCLUDE</dispatcher>
  <dispatcher>ERROR</dispatcher>
</filter-mapping -->

...

{code}
# Save the {{web.xml}} file.

...


# Start Magnolia CMS.

...


# Request the JSP script at http://localhost:8080/magnoliaAuthor/docroot/recovery-script.jsp

...

.

...


The script will bootstrap the superuser account to default settings. You should see the following line in the log:

...


{code

...

}
WARN  info.magnolia.importexport.BootstrapUtil: 
Deleted already existing node for bootstrapping: 
/system/superuser

...


{code}
# Stop Magnolia CMS.
# Remove the servlet mapping you added to {{web.xml}} and uncomment the {{<filter>}} and {{<filter-mapping>}} sections.
# Start Magnolia CMS.
# Log in as superuser with password {{superuser}}.