Add email field on openid registration; needed to register if RequireValidatedEmail plugin is also present.
This commit is contained in:
		@@ -127,6 +127,11 @@ class FinishopenidloginAction extends Action
 | 
				
			|||||||
                     ($this->username) ? $this->username : '',
 | 
					                     ($this->username) ? $this->username : '',
 | 
				
			||||||
                     _m('1-64 lowercase letters or numbers, no punctuation or spaces'));
 | 
					                     _m('1-64 lowercase letters or numbers, no punctuation or spaces'));
 | 
				
			||||||
        $this->elementEnd('li');
 | 
					        $this->elementEnd('li');
 | 
				
			||||||
 | 
					        $this->elementStart('li');
 | 
				
			||||||
 | 
					        $this->input('email', _('Email'), $this->getEmail(),
 | 
				
			||||||
 | 
					                     _('Used only for updates, announcements, '.
 | 
				
			||||||
 | 
					                       'and password recovery'));
 | 
				
			||||||
 | 
					        $this->elementEnd('li');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Hook point for captcha etc
 | 
					        // Hook point for captcha etc
 | 
				
			||||||
        Event::handle('EndRegistrationFormData', array($this));
 | 
					        Event::handle('EndRegistrationFormData', array($this));
 | 
				
			||||||
@@ -188,6 +193,39 @@ class FinishopenidloginAction extends Action
 | 
				
			|||||||
        $this->elementEnd('form');
 | 
					        $this->elementEnd('form');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Get specified e-mail from the form, or the OpenID sreg info, or the
 | 
				
			||||||
 | 
					     * invite code.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return string
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    function getEmail()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $email = $this->trimmed('email');
 | 
				
			||||||
 | 
					        if (!empty($email)) {
 | 
				
			||||||
 | 
					            return $email;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Pull from openid thingy
 | 
				
			||||||
 | 
					        list($display, $canonical, $sreg) = $this->getSavedValues();
 | 
				
			||||||
 | 
					        if (!empty($sreg['email'])) {
 | 
				
			||||||
 | 
					            return $sreg['email'];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Terrible hack for invites...
 | 
				
			||||||
 | 
					        if (common_config('site', 'inviteonly')) {
 | 
				
			||||||
 | 
					            $code = $_SESSION['invitecode'];
 | 
				
			||||||
 | 
					            if ($code) {
 | 
				
			||||||
 | 
					                $invite = Invitation::staticGet($code);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if ($invite && $invite->address_type == 'email') {
 | 
				
			||||||
 | 
					                    return $invite->address;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return '';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function tryLogin()
 | 
					    function tryLogin()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $consumer = oid_consumer();
 | 
					        $consumer = oid_consumer();
 | 
				
			||||||
@@ -355,11 +393,7 @@ class FinishopenidloginAction extends Action
 | 
				
			|||||||
            $fullname = '';
 | 
					            $fullname = '';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!empty($sreg['email']) && Validate::email($sreg['email'], common_config('email', 'check_domain'))) {
 | 
					        $email = $this->getEmail();
 | 
				
			||||||
            $email = $sreg['email'];
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            $email = '';
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # XXX: add language
 | 
					        # XXX: add language
 | 
				
			||||||
        # XXX: add timezone
 | 
					        # XXX: add timezone
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user