← Back to team overview

mahara-contributors team mailing list archive

[Bug 922031] [NEW] Suspended date time on a suspended user is not properly displayed when he tries to login

 

Public bug reported:

Mahara master 1.5 dev from git, using MySQL on Linux

When an user is suspended, its suspended date time is stored in table
usr as a formatted string yyyy-mm-dd : hh:nn and not as a standard Unix
timestamp, like in most other places of Mahara.

When the user tries to connect, the error message gives 'your account
has been suspended on 1 january 1970 , 0:132  reason : ....'

this is due to the fact that the function
ensure_user_account_is_active() defined in auth/lib.php does not convert
back the formatted datetime to an Unix timestamp before calling strftime
function :

 $suspendedctime  = strftime(get_string('strftimedaydate'),
$user->get('suspendedctime'));

where it should be :

 $suspendedctime  = strftime(get_string('strftimedaydate'),
strtotime($user->suspendedctime));


Attached a smal patch against master ( 1.5dev)  where I also changed get_string('strftimedaydate' to
get_string('strftimedaydatetime' to also display the time of suspension which is available 


according to a grep into all code , this should be fixed also in some other authentication plugins such as saml and xmlrpc 


[root@vm107-04 mahara]# grep -Rin strftimedaydate * |grep suspendedctime
auth/lib.php:1417:        $suspendedctime  = strftime(get_string('strftimedaydate'), $user->get('suspendedctime'));
auth/saml/lib.php:147:                die_info(get_string('accountsuspended', 'mahara', strftime(get_string('strftimedaydate'), $user->get('suspendedctime')), $user->get('suspendedreason')));
auth/saml/index.php:583:        $suspendedctime  = strftime(get_string('strftimedaydate'), $USER->suspendedctime);
auth/xmlrpc/lib.php:173:                die_info(get_string('accountsuspended', 'mahara', strftime(get_string('strftimedaydate'), $user->get('suspendedctime')), $user->get('suspendedreason')));


Cheers

** Affects: mahara
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
https://bugs.launchpad.net/bugs/922031

Title:
  Suspended date time on a suspended user is not properly displayed when
  he tries to login

Status in Mahara ePortfolio:
  New

Bug description:
  Mahara master 1.5 dev from git, using MySQL on Linux

  When an user is suspended, its suspended date time is stored in table
  usr as a formatted string yyyy-mm-dd : hh:nn and not as a standard
  Unix timestamp, like in most other places of Mahara.

  When the user tries to connect, the error message gives 'your account
  has been suspended on 1 january 1970 , 0:132  reason : ....'

  this is due to the fact that the function
  ensure_user_account_is_active() defined in auth/lib.php does not
  convert back the formatted datetime to an Unix timestamp before
  calling strftime function :

   $suspendedctime  = strftime(get_string('strftimedaydate'),
  $user->get('suspendedctime'));

  where it should be :

   $suspendedctime  = strftime(get_string('strftimedaydate'),
  strtotime($user->suspendedctime));


  Attached a smal patch against master ( 1.5dev)  where I also changed get_string('strftimedaydate' to
  get_string('strftimedaydatetime' to also display the time of suspension which is available 

  
  according to a grep into all code , this should be fixed also in some other authentication plugins such as saml and xmlrpc 

  
  [root@vm107-04 mahara]# grep -Rin strftimedaydate * |grep suspendedctime
  auth/lib.php:1417:        $suspendedctime  = strftime(get_string('strftimedaydate'), $user->get('suspendedctime'));
  auth/saml/lib.php:147:                die_info(get_string('accountsuspended', 'mahara', strftime(get_string('strftimedaydate'), $user->get('suspendedctime')), $user->get('suspendedreason')));
  auth/saml/index.php:583:        $suspendedctime  = strftime(get_string('strftimedaydate'), $USER->suspendedctime);
  auth/xmlrpc/lib.php:173:                die_info(get_string('accountsuspended', 'mahara', strftime(get_string('strftimedaydate'), $user->get('suspendedctime')), $user->get('suspendedreason')));

  
  Cheers

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/922031/+subscriptions


Follow ups

References