Skip to content

Commit

Permalink
disabled security token
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy committed Oct 6, 2011
1 parent e8ccef9 commit 109c860
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
7 changes: 4 additions & 3 deletions code/NewsletterAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ public function getMailingListEditForm($id) {
} else {
$form = false;
}

$form->disableSecurityToken();
return $form;

}
Expand Down Expand Up @@ -955,8 +955,9 @@ function UploadForm( $id = null ) {
$actions = new FieldSet(
new FormAction( "action_import", _t('NewsletterAdmin.SHOWCONTENTS','Show contents') )
);

return new RecipientImportField_UploadForm( $this, "UploadForm", $fields, $actions );
$form = new RecipientImportField_UploadForm( $this, "UploadForm", $fields, $actions );
$form->disableSecurityToken();
return $form;
}

function getMenuTitle() {
Expand Down
22 changes: 10 additions & 12 deletions code/controllers/UnsubscribeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ function __construct($data = null) {
function RelativeLink($action = null) {
return self::$url_segment."/$action";
}

private function getMember(){
$autoLoginHash = Convert::raw2sql($this->urlParams['AutoLoginHash']);
if($autoLoginHash) {
$member = DataObject::get_one('Member', "\"AutoLoginHash\" = '$autoLoginHash'");
return $member;
}
}

private function getMailingList(){
$mailingListID = (int)$this->urlParams['MailingList'];

Expand All @@ -37,7 +37,7 @@ private function getMailingList(){
};
}
}

function index() {
Session::clear("loggedInAs");
Requirements::themedCSS("form");
Expand Down Expand Up @@ -65,7 +65,7 @@ function index() {

function done() {
$form = new Form($this, "UnsubscribeSuccess", new FieldSet(), new FieldSet);

if(!self::$done_message){
$email = $this->getMember()->Email;
$mailingList = $this->getMailingList();
Expand All @@ -88,7 +88,7 @@ function done() {

function linksent(){
$form = new Form($this, "UnsubscribeLinkSent", new FieldSet(), new FieldSet);

if(isset($_GET['SendEmail']) && $_GET['SendEmail']){
$form -> setMessage(sprintf(_t('Unsubscribe.LINKSENTTO', "The unsubscribe link has been sent to %s"), $_GET['SendEmail']), "good");
return $this->customise(array(
Expand Down Expand Up @@ -120,7 +120,7 @@ function MailingListForm() {
function EmailAddressForm() {
return new Unsubscribe_EmailAddressForm( $this, 'EmailAddressForm' );
}

/**
* Show the lists for the user with the given email address
*/
Expand All @@ -141,17 +141,15 @@ function sendmeunsubscribelink( $data) {
}
$link = Director::absoluteBaseURL() . $this->RelativeLink('index') ."/" . $member->AutoLoginHash;
$membername = $member->getName();
$body = $this->customise(array(
'Content' => <<<HTML
$body = <<<HTML
Dear $membername,<br />
<p>Please click the link below to unsubscribe from our newsletters<br />
$link<br />
<a href="$link">$link</a><br />
<br >
<br >
Thanks
</p>
HTML
))->renderWith('Page');
HTML;
$email = new Email($from, $to, $subject, $body);
$result = $email -> send();
if($result){
Expand All @@ -172,7 +170,7 @@ function sendmeunsubscribelink( $data) {
Director::redirectBack();
}
}

/**
* Unsubscribe the user from the given lists.
*/
Expand Down

0 comments on commit 109c860

Please sign in to comment.