public function registerByAdmin() { $this->formAfterCheck(); if (!$this->hasErrors()) { $user = new Users('create'); $user->username = $this->username; $user->email = $this->email; $user->password = CPasswordHelper::hashPassword($this->password); $user->email_verified = intval($this->verified); if ($user->save()) { MailHelper::sendUserCredentials($this->username, $this->email, $this->password); if (!$this->verified) { $url_maintenance = $user->getMaintenanceUrl(); $user->save(); MailHelper::sendRegisterConfirmMail($user->username, $user->email, $url_maintenance); } ListingNames::model()->getUserIgnoreList($user->id); return true; } else { $this->addErrors($user->getErrors()); } } return false; }
if (!empty($user)) { completeInstallation('warning', 'Admin already created'); } $model = new UserForm('create_admin'); $model->username = '******'; if (isset($_POST['UserForm'])) { $model->attributes = $_POST['UserForm']; if ($model->validate()) { $user = new Users(); $user->id = 1; $user->username = $model->username; $user->password = CPasswordHelper::hashPassword($model->password); $user->email = $model->email; $user->email_verified = 1; if ($user->save()) { MailHelper::sendUserCredentials($model->username, $model->email, $model->password); completeInstallation('success', 'Admin user successfully created'); } } } ?> <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>Installation</title> <link rel="stylesheet" type="text/css" href="<?php echo Bootstrap::getBooster()->getAssetsUrl(); ?>