I have a Symfony 1.4 system that is used to dynamically load different site content from a single Symfony Project based on the domain name. This system has a backend and in the backend I have the "Forgot Your Password" functionality working great, with 1 issue. The email it sends from is set in apps/backend/config/app.yml with the setting:
all:
sf_guard_plugin:
routes_register: true
default_from_email: [email protected]
but I have multiple domains not just one.
In my DB I have stored the domain names, my controller has logic to get the current domain name, query the DB and then saves a session attribute of sid (site_id) which is the table id for the given domain.
What I want to do is have the ability to set the default_from_email to the current domain.
i.e. [email protected] or [email protected]
depending on which domain the end user used to access the site. My question is .. is there a way in the
app.yml file to put a variable %domain%
and then populate that somewhere related to the forgot password functionality in sfDoctrineGuardPlugin OR Is there a way to override the sfDoctrineGuardPlugin sfGuardForgotPassword module to insert the logic to use the current domain as the from email
Currently my solution was to insert logic into the BasesfGuardForgotPasswordActions.class.php, this is NOT THE RIGHT WAY (though it works), but I needed a quick fix.
Of course, you can override the default handling of sfGuardForgotPassword:
sfGuardForgotPassword
in your apps/modules folderactions
actions.class.php
with this insideactions.class.php
<?php
require_once(sfConfig::get('sf_plugins_dir').'/sfDoctrineGuardPlugin/modules/sfGuardForgotPassword/lib/BasesfGuardForgotPasswordActions.class.php');
/**
*
* @package symfony
* @subpackage plugin
* @author Fabien Potencier <[email protected]>
* @version SVN: $Id: actions.class.php 23319 2009-10-25 12:22:23Z Kris.Wallsmith $
*/
class sfGuardForgotPasswordActions extends BasesfGuardForgotPasswordActions
{
protected function sendRequestMail($user, $forgotPassword)
{
// send the mail as you want
}
protected function sendChangeMail($user, $password)
{
// send the mail as you want
}
}