web-base/core/Views/Account/Register.class.php

68 lines
2.5 KiB
PHP
Raw Normal View History

2020-06-20 15:49:53 +02:00
<?php
namespace Views\Account;
use Elements\Document;
2020-07-01 22:13:50 +02:00
class Register extends AccountView {
2020-06-20 15:49:53 +02:00
public function __construct(Document $document, $loadView = true) {
parent::__construct($document, $loadView);
2020-07-01 22:13:50 +02:00
$this->title = "Registration";
$this->description = "Create a new account";
2020-07-01 23:07:00 +02:00
$this->icon = "user-plus";
2020-06-20 15:49:53 +02:00
}
2020-07-01 22:13:50 +02:00
public function loadView() {
parent::loadView();
2020-06-20 15:49:53 +02:00
2020-07-01 22:13:50 +02:00
$document = $this->getDocument();
$settings = $document->getUser()->getConfiguration()->getSettings();
if ($settings->isRecaptchaEnabled()) {
$document->getHead()->loadGoogleRecaptcha($settings->getRecaptchaSiteKey());
}
}
public function getAccountContent() {
$settings = $this->getDocument()->getUser()->getConfiguration()->getSettings();
if (!$settings->isRegistrationAllowed()) {
return $this->createErrorText(
"Registration is not enabled on this website. If you are an administrator,
goto <a href=\"/admin/settings\">/admin/settings</a>, to enable the user registration"
);
}
return "<h4 class=\"pb-4\">Please fill with your details</h4>
<form>
2020-07-01 23:07:00 +02:00
<div class=\"input-group\">
<div class=\"input-group-append\">
<span class=\"input-group-text\"><i class=\"fas fa-hashtag\"></i></span>
</div>
2020-07-01 22:13:50 +02:00
<input id=\"username\" name=\"username\" placeholder=\"Username\" class=\"form-control\" type=\"text\" maxlength=\"32\">
</div>
2020-07-01 23:07:00 +02:00
<div class=\"input-group mt-3\">
<div class=\"input-group-append\">
<span class=\"input-group-text\"><i class=\"fas fa-at\"></i></span>
</div>
2020-07-01 22:13:50 +02:00
<input type=\"email\" name='email' id='email' class=\"form-control\" placeholder=\"Email\" maxlength=\"64\">
</div>
2020-07-01 23:07:00 +02:00
<div class=\"input-group mt-3\">
<div class=\"input-group-append\">
<span class=\"input-group-text\"><i class=\"fas fa-key\"></i></span>
</div>
2020-07-01 22:13:50 +02:00
<input type=\"password\" name='password' id='password' class=\"form-control\" placeholder=\"Password\">
</div>
2020-07-01 23:07:00 +02:00
<div class=\"input-group mt-3\">
<div class=\"input-group-append\">
<span class=\"input-group-text\"><i class=\"fas fa-key\"></i></span>
</div>
2020-07-01 22:13:50 +02:00
<input type=\"password\" name='confirmPassword' id='confirmPassword' class=\"form-control\" placeholder=\"Confirm Password\">
</div>
2020-07-01 23:07:00 +02:00
<div class=\"input-group mt-3\">
2020-07-01 22:13:50 +02:00
<button type=\"button\" class=\"btn btn-success\" id='btnRegister'>Submit</button>
</div>
</form>";
2020-06-20 15:49:53 +02:00
}
}