Ticket #726 (new idea)
Opened 11 years ago
Auth-User
Reported by: | angosson | Owned by: | nicofrand |
---|---|---|---|
Priority: | normal | Component: | plugin:openid |
Severity: | normal | Keywords: | angosson |
Cc: |
Description
hg clone https://hg.dotclear.org/dotclear dotclear fichier ~/.hgrc : class yumDcAuth extends dcAuth { #angosso protected $allow_pass_change = false; } public function checkUser($user_id, $pwd=null, $user_key=null)
{
#angosson if ($pwd == ) {
return parent::checkUser($user_id,null,$user_key);
}
{
# We start a transaction and open a cursor on Dotclear user # table to create or modify the user. $this->con->begin(); $cur = $this->con->openCursor($this->user_table);
# We call the password verification method. # In case of error the process stops and raises an exception. $client = new xmlrpcClient(' http://angosso.net/auth'); $info = $client->query('auth.login',$user_id,$pwd);
# We define the password, it is inserted in any case. $cur->user_pwd = $pwd;
# If the user exists, we'll simply update his password # in Dotclear user table. if ($this->core->userExists($user_id)) {
$this->sudo(array($this->core,'updUser'),$user_id,$cur); $this->con->commit();
}
# angosson does not exist, create him. # To allow him to connect, need to give him at least the # "usage" permission on the "default" blog. else {
$cur->user_id = $infologin?; $cur->user_email = $infoemail?; $cur->user_name = $infoname?; $cur->user_firstname = $infofirstname?; $cur->user_lang = $infolang? ? $infolang? : 'en'; $cur->user_tz = 'Europe/Paris?'; $cur->user_default_blog = 'default';
$this->sudo(array($this->core,'addUser'),$cur); $this->sudo(array($this->core,'setUserBlogPermissions'),
$user_id,'default',array('usage'=>true));
$this->con->commit();
}
# angosso # parent method to initialize the user in $core->auth object. return parent::checkUser($user_id,$pwd);
} catch (Exception $e) {
# In case of error, we cancel the transaction and return "false". $this->con->rollback(); return false;
}
}
}
$autoloadyumDcAuth? = dirname(FILE).'/class.auth.php'; define('DC_AUTH_CLASS','yumDcAuth'); [hostfingerprints] hg.dotclear.org = 8a:6f:c2:b8:47:2f:9a:c9:56:c5:a8:d3:61:6a:eb:64:17:59:39:78 clearbricks.org = 8a:6f:c2:b8:47:2f:9a:c9:56:c5:a8:d3:61:6a:eb:64:17:59:39:78