CC-3110 : Password reset
added sender email to preferences form, created db upgrade script.
This commit is contained in:
parent
cf2813a545
commit
0b3809c379
|
@ -56,7 +56,7 @@ class AuthController extends Zend_Controller_Action
|
|||
//check validity of token
|
||||
if (!$auth->checkToken($user_id, $token, 'password.restore')) {
|
||||
echo "token not valid";
|
||||
//$this->_helper->redirector('index', 'login');
|
||||
$this->_helper->redirector('index', 'login');
|
||||
}
|
||||
|
||||
if ($request->isPost() && $form->isValid($request->getPost())) {
|
||||
|
@ -82,7 +82,7 @@ class AuthController extends Zend_Controller_Action
|
|||
$authStorage = $zend_auth->getStorage();
|
||||
$authStorage->write($userInfo);
|
||||
|
||||
$this->_helper->redirector('index', 'nowplaying');
|
||||
$this->_helper->redirector('index', 'showbuilder');
|
||||
}
|
||||
|
||||
$this->view->form = $form;
|
||||
|
|
|
@ -39,6 +39,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
Application_Model_Preference::SetAllow3rdPartyApi($values["preferences_general"]["thirdPartyApi"]);
|
||||
Application_Model_Preference::SetTimezone($values["preferences_general"]["timezone"]);
|
||||
Application_Model_Preference::SetWeekStartDay($values["preferences_general"]["weekStartDay"]);
|
||||
Application_Model_Preference::SetSystemEmail($values["preferences_general"]["systemEmail"]);
|
||||
|
||||
Application_Model_Preference::SetAutoUploadRecordedShowToSoundcloud($values["preferences_soundcloud"]["UseSoundCloud"]);
|
||||
Application_Model_Preference::SetUploadToSoundcloudOption($values["preferences_soundcloud"]["UploadToSoundcloudOption"]);
|
||||
|
|
|
@ -64,6 +64,20 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
|||
$week_start_day->setValue(Application_Model_Preference::GetWeekStartDay());
|
||||
$week_start_day->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($week_start_day);
|
||||
|
||||
// Add end date element
|
||||
$systemEmail = new Zend_Form_Element_Text('systemEmail');
|
||||
$systemEmail->class = 'input_text';
|
||||
$systemEmail->setRequired(false)
|
||||
->setValue(Application_Model_Preference::GetSystemEmail())
|
||||
->setLabel('Airtime System Email')
|
||||
->setFilters(array('StringTrim'))
|
||||
->setValidators(array(
|
||||
'NotEmpty',
|
||||
'EmailAddress'
|
||||
))
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($systemEmail);
|
||||
}
|
||||
|
||||
private function getTimezones(){
|
||||
|
|
|
@ -6,7 +6,7 @@ class Application_Model_Auth {
|
|||
|
||||
private function generateToken($action, $user_id)
|
||||
{
|
||||
$salt = "pro";
|
||||
$salt = md5("pro");
|
||||
$token = self::generateRandomString();
|
||||
|
||||
$info = new CcSubjsToken();
|
||||
|
@ -25,10 +25,7 @@ class Application_Model_Auth {
|
|||
|
||||
$e_link_protocol = empty($_SERVER['HTTPS']) ? "http" : "https";
|
||||
$e_link_base = $_SERVER['SERVER_NAME'];
|
||||
$e_link_path = $view->url(array('user_id' => $user->getDbId(),
|
||||
'token' => $token
|
||||
),
|
||||
'password-change');
|
||||
$e_link_path = $view->url(array('user_id' => $user->getDbId(), 'token' => $token), 'password-change');
|
||||
|
||||
$message = "Click this link: {$e_link_protocol}://{$e_link_base}{$e_link_path}";
|
||||
|
||||
|
@ -45,7 +42,7 @@ class Application_Model_Auth {
|
|||
|
||||
public function checkToken($user_id, $token, $action)
|
||||
{
|
||||
$salt = "pro";
|
||||
$salt = md5("pro");
|
||||
|
||||
$token_info = CcSubjsTokenQuery::create()
|
||||
->filterByDbAction($action)
|
||||
|
|
|
@ -12,20 +12,10 @@ class Application_Model_Email {
|
|||
*/
|
||||
public static function send($subject, $message, $tos, $from = null)
|
||||
{
|
||||
/*
|
||||
$configMail = array( 'auth' => 'login',
|
||||
'username' => 'user@gmail.com',
|
||||
'password' => 'password',
|
||||
'ssl' => 'ssl',
|
||||
'port' => 465
|
||||
);
|
||||
$mailTransport = new Zend_Mail_Transport_Smtp('smtp.gmail.com',$configMail);
|
||||
*/
|
||||
|
||||
$mail = new Zend_Mail('utf-8');
|
||||
$mail->setSubject($subject);
|
||||
$mail->setBodyText($message);
|
||||
$mail->setFrom(isset($from) ? $from : 'naomi.aro@sourcefabric.org');
|
||||
$mail->setFrom(isset($from) ? $from : Application_Model_Preference::GetSystemEmail());
|
||||
|
||||
foreach ((array) $tos as $to) {
|
||||
$mail->addTo($to);
|
||||
|
|
|
@ -772,6 +772,14 @@ class Application_Model_Preference
|
|||
public static function GetLiveDJSourceConnectionURL(){
|
||||
return self::GetValue("live_dj_source_connection_url");
|
||||
}
|
||||
|
||||
public static function SetSystemEmail($value) {
|
||||
self::SetValue("system_email", $value, false);
|
||||
}
|
||||
|
||||
public static function GetSystemEmail() {
|
||||
return self::GetValue("system_email");
|
||||
}
|
||||
/* User specific preferences end */
|
||||
|
||||
public static function ShouldShowPopUp(){
|
||||
|
|
|
@ -92,5 +92,21 @@
|
|||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
|
||||
<!-- System Email option -->
|
||||
<dt id="systemEmail-label" class="block-display">
|
||||
<label class="required" for="timezone"><?php echo $this->element->getElement('systemEmail')->getLabel() ?>:
|
||||
</label>
|
||||
</dt>
|
||||
<dd id="systemEmail-element" class="block-display">
|
||||
<?php echo $this->element->getElement('systemEmail') ?>
|
||||
<?php if($this->element->getElement('systemEmail')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<?php foreach($this->element->getElement('systemEmail')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
|
|
@ -11,7 +11,7 @@ class AirtimeDatabaseUpgrade{
|
|||
}
|
||||
|
||||
private static function task0(){
|
||||
UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120403143635');
|
||||
UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120405114454');
|
||||
$sql = "INSERT INTO cc_pref(\"keystr\", \"valstr\") VALUES('scheduled_play_switch', 'on')";
|
||||
UpgradeCommon::nonSelectQueryDb($sql);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Migrations\AbstractMigration,
|
||||
Doctrine\DBAL\Schema\Schema;
|
||||
|
||||
class Version20120405114454 extends AbstractMigration
|
||||
{
|
||||
public function up(Schema $schema)
|
||||
{
|
||||
//create cc_subjs_token table
|
||||
$cc_subjs_token = $schema->createTable('cc_subjs_token');
|
||||
|
||||
$cc_subjs_token->addColumn('id', 'integer', array('unsigned' => true, 'autoincrement' => true));
|
||||
$cc_subjs_token->addColumn('show_id', 'integer', array('notnull' => 1));
|
||||
$cc_subjs_token->addColumn('action', 'string', array('length' => 255, 'notnull' => 1));
|
||||
$cc_subjs_token->addColumn('token', 'string', array('length' => 40, 'notnull' => 1));
|
||||
$cc_subjs_token->addColumn('created', 'datetime', array('notnull' => 1));
|
||||
|
||||
$cc_subjs_token->setPrimaryKey(array('id'));
|
||||
|
||||
$cc_subjs = $schema->getTable('cc_subjs');
|
||||
$cc_subjs_token->addNamedForeignKeyConstraint('cc_subjs_token_userid_fkey', $cc_subjs, array('user_id'), array('id'));
|
||||
$cc_subjs_token->addUniqueIndex(array('token'), 'uniq_token');
|
||||
//end create cc_subjs_token table
|
||||
}
|
||||
|
||||
public function down(Schema $schema)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue