Example #1
0
 function __construct()
 {
     // Only allow guests to view this page
     parent::guestOnly();
     /* Has the admin disabled user registrations? */
     $disable = parent::getOption('disable-registrations-enable');
     if ($disable) {
         $this->error = sprintf('<div class="alert alert-block alert-error">%s</div>', _('<h4 class="alert-heading">Registrations disabled.</h4><p>Already have an account? <a href="login.php">Sign in here</a>!</p>'));
         parent::displayMessage($this->error, true);
     }
     $this->use_emails = parent::getOption('email-as-username-enable');
     $this->username_type = $this->use_emails ? 'email' : 'username';
     // jQuery form validation
     parent::checkExists();
     // Generate a unique token for security purposes
     parent::generateToken();
     // Has the form been submitted?
     if (!empty($_POST)) {
         // Sign up form post data
         foreach ($_POST as $field => $value) {
             $this->settings[$field] = parent::secure($value);
         }
         $this->process();
     }
     if (isset($_GET['new_social'])) {
         $this->error = sprintf('<div class="alert alert-success">%s</div>', _('We don\'t see you as a registered user. Perhaps you\'d like to sign up :)'));
     }
     parent::displayMessage($this->error, false);
 }
 public function process()
 {
     // Only allow guests to view this page
     parent::guestOnly();
     // Check for correct and complete values
     $this->validate();
     // If there are no errors, let's reset the password
     $this->resetpw();
     // Show the form if $_GET key is set
     $this->reset_form();
 }