Skip to content

OSS_Controller_Trait_Auth

Barry O'Donovan edited this page Jul 15, 2013 · 2 revisions

This controller provides canned functionality for:

  • user authentication (including remember me functionality);
  • lost password and reset password functionality;
  • switch / substitute user functionality;
  • lost username functionality.

Email Templates

There are three email templates used by this controller. Override the following constant to change the default location:

/**
 * Template path
 *
 *@var string $TEMPLATE_PATH 
 */
private static $TEMPLATE_PATH = "auth/email";

Within that directory (or a skin directory), add / edit files as follows:

  • Plaintext
    • $TEMPLATE_PATH/plaintext/lost-password.txt
    • $TEMPLATE_PATH/plaintext/lost-username.txt
    • $TEMPLATE_PATH/plaintext/reset-password.txt
  • HTML
    • $TEMPLATE_PATH/html/lost-password.phtml
    • $TEMPLATE_PATH/html/lost-username.phtml
    • $TEMPLATE_PATH/html/reset-password.phtml

By default, if both plaintext and html templates exist, a mail will be sent as an MIME multipart message containing both. Otherwise, which format is found is sent in the appropriate encoding format.

You can force one of the other via a configuration option:

;; format to use when sending authentication messages
;; See: https://github.com/opensolutions/OSS-Framework/wiki/OSS_Controller_Trait_Auth
;;
;; The default when nothing is set is 'both' which will send both formats if available
;; or whatever format is found if there is only one format.
resources.auth.oss.email_format = 'html|plaintext|both'

See this repository directory for sample templates.

Clone this wiki locally