From c02a01914ab67c2bc25850034a75ee1046fd6870 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 17 Jun 2008 09:35:01 -0400 Subject: [PATCH] start openid rp integration darcs-hash:20080617133501-84dde-adec156ac58b84cce41ae0e9bde58cf7637e6c42.gz --- actions/openidlogin.php | 57 ++++++++++ classes/Avatar.php | 6 +- classes/Profile.php | 12 +-- classes/User_openid.php | 23 ++++ classes/stoica.ini | 10 ++ db/laconica.sql | 30 +++++- doc/roadmap | 233 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 361 insertions(+), 10 deletions(-) create mode 100644 actions/openidlogin.php create mode 100644 classes/User_openid.php create mode 100644 doc/roadmap diff --git a/actions/openidlogin.php b/actions/openidlogin.php new file mode 100644 index 0000000000..0a5182a61b --- /dev/null +++ b/actions/openidlogin.php @@ -0,0 +1,57 @@ +. + */ + +if (!defined('LACONICA')) { exit(1); } + +class OpenidloginAction extends Action { + + function handle($args) { + parent::handle($args); + if (common_logged_in()) { + common_user_error(_t('Already logged in.')); + } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { + $this->start_openid_login(); + } else { + $this->show_form(); + } + } + + function show_form($error=NULL) { + common_show_header(_t('OpenID Login')); + if ($error) { + common_element('div', array('class' => 'error'), $error); + } else { + common_element('div', 'instructions', + _t('Login with an OpenID account.')); + } + common_element_start('form', array('method' => 'POST', + 'id' => 'openidlogin', + 'action' => common_local_url('openidlogin'))); + common_input('openid_url', _t('OpenID URL')); + common_submit('submit', _t('Login')); + common_element_end('form'); + common_show_footer(); + } + + function check_login() { + # XXX: form token in $_SESSION to prevent XSS + # XXX: login throttle + $openid_url = $this->trimmed('openid_url'); + } +} diff --git a/classes/Avatar.php b/classes/Avatar.php index 24dca038ee..1807770534 100644 --- a/classes/Avatar.php +++ b/classes/Avatar.php @@ -4,18 +4,18 @@ */ require_once 'DB/DataObject.php'; -class Avatar extends DB_DataObject +class Avatar extends DB_DataObject { ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */ public $__table = 'avatar'; // table name public $profile_id; // int(4) primary_key not_null - public $original; // tinyint(1) + public $original; // tinyint(1) public $width; // int(4) primary_key not_null public $height; // int(4) primary_key not_null public $mediatype; // varchar(32) not_null - public $filename; // varchar(255) + public $filename; // varchar(255) public $url; // varchar(255) unique_key public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP diff --git a/classes/Profile.php b/classes/Profile.php index 5a45d43979..000590a98f 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -24,7 +24,7 @@ if (!defined('LACONICA')) { exit(1); } */ require_once 'DB/DataObject.php'; -class Profile extends DB_DataObject +class Profile extends DB_DataObject { ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */ @@ -32,11 +32,11 @@ class Profile extends DB_DataObject public $__table = 'profile'; // table name public $id; // int(4) primary_key not_null public $nickname; // varchar(64) not_null - public $fullname; // varchar(255) - public $profileurl; // varchar(255) - public $homepage; // varchar(255) - public $bio; // varchar(140) - public $location; // varchar(255) + public $fullname; // varchar(255) + public $profileurl; // varchar(255) + public $homepage; // varchar(255) + public $bio; // varchar(140) + public $location; // varchar(255) public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP diff --git a/classes/User_openid.php b/classes/User_openid.php new file mode 100644 index 0000000000..9811879ece --- /dev/null +++ b/classes/User_openid.php @@ -0,0 +1,23 @@ +