Recover Your Password

Return to Product Support > Learning Center > Developer References > Creating a custom login

Creating a custom login

The internal Contensive login form is controlled through the addon 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 addon. 

You can create an addon 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 addon 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 addon that calls this login addon and redirects back to the site on success.

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