Browse Source

account expiration structures

pull/1/head
Friendika 10 years ago
parent
commit
5b3f645939
  1. 2
      boot.php
  2. 3
      database.sql
  3. 2
      include/api.php
  4. 4
      include/auth.php
  5. 2
      mod/openid.php
  6. 9
      update.php

2
boot.php

@ -9,7 +9,7 @@ require_once("include/pgettext.php");
define ( 'FRIENDIKA_VERSION', '2.3.1108' );
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
define ( 'DB_UPDATE_VERSION', 1088 );
define ( 'DB_UPDATE_VERSION', 1089 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

3
database.sql

@ -413,6 +413,9 @@ CREATE TABLE IF NOT EXISTS `user` (
`pwdreset` char(255) NOT NULL,
`maxreq` int(11) NOT NULL DEFAULT '10',
`expire` int(11) unsigned NOT NULL DEFAULT '0',
`account_expired` tinyint( 1 ) NOT NULL DEFAULT '0',
`account_expires_on` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`expire_notification_sent` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`allow_cid` mediumtext NOT NULL,
`allow_gid` mediumtext NOT NULL,
`deny_cid` mediumtext NOT NULL,

2
include/api.php

@ -55,7 +55,7 @@
// process normal login request
$r = q("SELECT * FROM `user` WHERE ( `email` = '%s' OR `nickname` = '%s' )
AND `password` = '%s' AND `blocked` = 0 AND `verified` = 1 LIMIT 1",
AND `password` = '%s' AND `blocked` = 0 AND `account_expired` = 0 AND `verified` = 1 LIMIT 1",
dbesc(trim($user)),
dbesc(trim($user)),
dbesc($encrypted)

4
include/auth.php

@ -49,7 +49,7 @@ if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-p
}
$r = q("SELECT `user`.*, `user`.`pubkey` as `upubkey`, `user`.`prvkey` as `uprvkey`
FROM `user` WHERE `uid` = %d LIMIT 1",
FROM `user` WHERE `uid` = %d AND `blocked` = 0 AND `account_expired` = 0 AND `verified` = 1 LIMIT 1",
intval($_SESSION['uid'])
);
@ -186,7 +186,7 @@ else {
$r = q("SELECT `user`.*, `user`.`pubkey` as `upubkey`, `user`.`prvkey` as `uprvkey`
FROM `user` WHERE ( `email` = '%s' OR `nickname` = '%s' )
AND `password` = '%s' AND `blocked` = 0 AND `verified` = 1 LIMIT 1",
AND `password` = '%s' AND `blocked` = 0 AND `account_expired` = 0 AND `verified` = 1 LIMIT 1",
dbesc(trim($_POST['openid_url'])),
dbesc(trim($_POST['openid_url'])),
dbesc($encrypted)

2
mod/openid.php

@ -56,7 +56,7 @@ function openid_content(&$a) {
$r = q("SELECT `user`.*, `user`.`pubkey` as `upubkey`, `user`.`prvkey` as `uprvkey`
FROM `user` WHERE `openid` = '%s' AND `blocked` = 0 AND `verified` = 1 LIMIT 1",
FROM `user` WHERE `openid` = '%s' AND `blocked` = 0 AND `account_expired` = 0 AND `verified` = 1 LIMIT 1",
dbesc($_SESSION['openid'])
);
if(! count($r)) {

9
update.php

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1088 );
define( 'UPDATE_VERSION' , 1089 );
/**
*
@ -743,3 +743,10 @@ function update_1087() {
}
}
}
function update_1088() {
q("ALTER TABLE `user` ADD `account_expired` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `expire` ,
ADD `account_expires_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `account_expired` ,
ADD `expire_notification_sent` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `account_expires_on` ");
}
Loading…
Cancel
Save