mirror of
https://github.com/friendica/friendica
synced 2024-11-10 05:02:58 +00:00
secure admin hijacking from openid
This commit is contained in:
parent
bb0c24bd4f
commit
95507cf90f
1 changed files with 11 additions and 0 deletions
|
@ -37,8 +37,13 @@ function register_post(&$a) {
|
|||
$openid_url = ((x($_POST,'openid_url')) ? notags(trim($_POST['openid_url'])) : '');
|
||||
$photo = ((x($_POST,'photo')) ? notags(trim($_POST['photo'])) : '');
|
||||
|
||||
$tmp_str = $openid_url;
|
||||
if((! x($username)) || (! x($email)) || (! x($nickname))) {
|
||||
if($openid_url) {
|
||||
if(! validate_url($tmp_str)) {
|
||||
notice( t('Invalid OpenID url') . EOL);
|
||||
return;
|
||||
}
|
||||
$_SESSION['register'] = 1;
|
||||
$_SESSION['openid'] = $openid_url;
|
||||
require_once('library/openid.php');
|
||||
|
@ -82,6 +87,12 @@ function register_post(&$a) {
|
|||
if((! valid_email($email)) || (! validate_email($email)))
|
||||
$err .= t('Not a valid email address.') . EOL;
|
||||
|
||||
// Disallow somebody creating an account using openid that uses the admin email address,
|
||||
// since openid bypasses email verification.
|
||||
|
||||
if((x($a->config,'admin_email')) && (strcasecmp($email,$a->config['admin_email']) == 0) && strlen($openid_url))
|
||||
$err .= t('Cannot use that email.') . EOL;
|
||||
|
||||
$nickname = $_POST['nickname'] = strtolower($nickname);
|
||||
|
||||
if(! preg_match("/^[a-z][a-z0-9\-\_]*$/",$nickname))
|
||||
|
|
Loading…
Reference in a new issue