Browse Source

secure admin hijacking from openid

pull/1/head
Friendika 11 years ago
parent
commit
95507cf90f
1 changed files with 11 additions and 0 deletions
  1. +11
    -0
      mod/register.php

+ 11
- 0
mod/register.php View File

@ -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…
Cancel
Save