CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • How to increase the duration of the checksum tocken (cs ?)
Pages: [1] 2

Author Topic: How to increase the duration of the checksum tocken (cs ?)  (Read 3327 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
How to increase the duration of the checksum tocken (cs ?)
May 13, 2009, 03:33:59 pm
Hello,

For what I read, it's 7 days duration for this token. I would like to increase that duration, is there a parameter or shall I touch the code ?

CRM/Contact/BAO/Contact/Utils.php

Code: [Select]
      // checksum matches so now check timestamp
        $now = time( );
        return ( $inputTS + ( $inputLF * 60 * 60 ) >= $now ) ? true : false;
 

-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: How to increase the duration of the checksum tocken (cs ?)
May 13, 2009, 07:40:49 pm

you'll need to touch the code:

CRM/Contact/BAO/Contact/Utils.php, line 118

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: How to increase the duration of the checksum tocken (cs ?)
May 14, 2009, 02:31:00 am
hi

Currently for event phase 3 we did some modification for checksum in trunk.

Now we can have checksum for specific life or we can generate checksum which having infinite life time.
default life for checksum is 7 day's.

you can check patch here : http://fisheye.civicrm.org/changelog/CiviCRM?cs=20574

hope this help
kiran
« Last Edit: May 14, 2009, 06:57:21 am by Donald Lobo »
You Are Designed To Choose... Defined By Choice.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: How to increase the duration of the checksum tocken (cs ?)
May 14, 2009, 04:00:01 am
Thanks.

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: How to increase the duration of the checksum tocken (cs ?)
September 25, 2009, 02:47:09 pm
So can I just confirm that editing the line 118 from
Quote
     if ( ! $live ) {$live = 24 * 7;}
to
Quote
     if ( ! $live ) {$live = 24 * 10;}

is suffiicient to change the checksum from lasting for 7 days to 10 days.

It isn't something that is going to be easy to test quickly ;-)

And can we switch it back to 7 days immediately after sending the email, or only after that 10 day period has expired.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: How to increase the duration of the checksum tocken (cs ?)
September 25, 2009, 03:13:37 pm

its used for both the test and the validation, so to be safe i'd do it 10 days after sending the email

you can also modify the code and use 7 minutes and 10 minutes to test the scenario, so something like

Code: [Select]
if ( ! $live ) {$live = ( 24 * 10 ) / 60;}

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: How to increase the duration of the checksum tocken (cs ?)
September 25, 2009, 03:45:42 pm
Thanks Lobo
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: How to increase the duration of the checksum tocken (cs ?)
July 27, 2011, 05:12:40 pm
Lobo - would you be open to having a constant in civicrm_settings.php

DEFINE('checksum_duration_days',7);

(default being 7) to allow people to over-ride?
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: How to increase the duration of the checksum tocken (cs ?)
July 27, 2011, 11:54:32 pm

We should make it as a configurable option in the UI and store in config object.

Should not be too hard

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: How to increase the duration of the checksum tocken (cs ?)
July 28, 2011, 12:51:41 am
Hi,

We discussed in the past having different tokens more specialised. eg a cs for event registration that won't allow to update via another profile...

I think that's like for dedupe: one size won't fit all, we should offer different cs for different usage with different validity, not making it easier to change on validity for all.

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: How to increase the duration of the checksum tocken (cs ?)
March 13, 2012, 07:11:15 pm
Just looking at this.....

Code: [Select]
        } else if ( $token == 'checksum' ) {
            require_once 'CRM/Contact/BAO/Contact/Utils.php';
            $cs = CRM_Contact_BAO_Contact_Utils::generateChecksum( $contact['contact_id'],
                                                                   null,
                                                                   null,
                                                                   $contact['hash'] );
            $value = "cs={$cs}";

We could introduce the option of appending a duration to the checksum - e.g

Code: [Select]
        } else if ( substr($token,0,8) == 'checksum' ) {
            $checksumDuration = 7;
            if(strstr($token,'_')){
              $checksumDuration = substr($token,10);
            }
            require_once 'CRM/Contact/BAO/Contact/Utils.php';
            $cs = CRM_Contact_BAO_Contact_Utils::generateChecksum( $contact['contact_id'],
                                                                   null,
                                                                   $checksumDuration,
                                                                   $contact['hash'] );
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: How to increase the duration of the checksum tocken (cs ?)
March 13, 2012, 07:12:38 pm
The above (with modifications for the fact it's not yet tried)

would accept

{contact.checksum_21} for 21 days or default to 7 for {contact.checksum}
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: How to increase the duration of the checksum tocken (cs ?)
March 13, 2012, 08:07:09 pm

how about something like:

{contact.checksum:d=21}

i.e. use : instead of _ since we can then extend it to send more parameters (and using positional does not seem too extensible, which is what smarty plugins use)

so then we can have {event.title:id=34} or {contribution.total:cid=23:start_date=2011-01-01:end_date=2012-01-01}

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: How to increase the duration of the checksum tocken (cs ?)
March 13, 2012, 08:38:01 pm
OK - if that's more consistent with existing syntax. Unless client gets excitable about it in the next couple of weeks lets' put it on the sprint list
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: How to increase the duration of the checksum tocken (cs ?)
February 27, 2013, 08:48:11 pm
Have things changed on this - Eileen ref to redmine #1328
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • How to increase the duration of the checksum tocken (cs ?)

This forum was archived on 2017-11-26.