protected function prepareApplicationCertificate(&$data) { $this->key = renegade_generate_token($this->data['application']); $this->secret = renegade_generate_token($this->data['application']); $data['key'] = $this->key; $data['secret'] = $this->secret; if ($this->data) { $data = array_merge($data, $this->data); } $data = array('key' => RenegadeConstants::kTypeCertificate . ':' . $this->key, 'value' => $data); }
$form->addValidator(new UniqueUsernameValidator('inputName', true, 'Username is not unique, please choose an alternative name')); $form->addValidator(new AMEmailValidator('inputEmail', true, 'Please provide a valid e-mail address')); $form->addValidator(new UniqueEmailValidator('inputEmail', true, 'Email address is currently in use')); $form->addValidator(new AMMatchValidator('inputPassword', 'inputPasswordVerify', true, 'Password must match')); $form->addValidator(new AMInputValidator('inputPassword', true, 4, null, 'Password must be at least 4 characters long')); $form->addValidator(new AMPatternValidator('inputPassword', true, '/^[\\S]+$/', 'Password cannot contain spaces')); $form->validate(); if ($form->isValid) { $user = new User(); $user->email = $form->inputEmail; $user->password = $form->inputPassword; $user->id = $form->inputName; $user->verified = false; $id = strtolower($form->inputName); $db = Renegade::database(RenegadeConstants::kDatabaseRedis, RenegadeConstants::kDatabaseUsers); $verification_token = renegade_generate_token(); User::generateVerificationForUserWithKey($user, $verification_token); // by the time we are here, we can set the record // but just in case we run msetnx to be sure we are not overwritting someone elses account. $db->msetnx($user->array); $email = new AuthorizeAccountMail(array(strtolower($form->inputEmail)), $verification_token); $email->send(); } else { foreach ($form->validators as $validator) { if ($validator->isValid == false) { echo $validator->message . "\n"; } } } } else { header('Location: /');