Creating a custom login

From Contensive Wiki
Jump to: navigation, search

The internal Contensive login form is controlled through the add-on selection on the security tab of the preferences page. This login form is used through the system, and is returned when the getLoginForm() method is called, internally by Contensive or by any other add-on.

You can create an add-on that replaces the response to this call, thereby replacing the Contensive login form.

A Login Form add-on should:

  • create the form with its action set to process on the same page is it displayed.
  • Use the cp.doc.getProperty() methods to read the request variables.
  • Use the cp.user.login() methods to authenticate.
  • Use the cp.email.sendPassword() to recover the password.
  • After a successful login, instead of returning the login form again, return a blank response. This signals the system to redirect back to the appropriate page.
  • It should NOT be a placeable add-on used on a page by itself, since a successful login just returns a blank response. Instead, if you need something to drop on a page, create a placeable add-on that calls this login add-on and redirects back to the site on success.

An example of a login form is in the Login Lightbox Collection.