Register: Adding implementation of registration disablement

Also temporarily removed AudiosPresenter
This commit is contained in:
Ilya Prokopenko 2021-09-13 19:00:54 +03:00
parent f58464a1e3
commit 9ba232d254
No known key found for this signature in database
GPG key ID: 7736BBBB05F14A56
6 changed files with 94 additions and 77 deletions

View file

@ -79,6 +79,9 @@ final class AuthPresenter extends OpenVKPresenter
if($_SERVER["REQUEST_METHOD"] === "POST") { if($_SERVER["REQUEST_METHOD"] === "POST") {
$this->assertCaptchaCheckPassed(); $this->assertCaptchaCheckPassed();
if(!OPENVK_ROOT_CONF['openvk']['preferences']['registration']['enable'] && !$referer)
$this->flashFail("err", "Подозрительная попытка регистрации", "Регистрация отключена системным администратором.");
if(!$this->ipValid()) if(!$this->ipValid())
$this->flashFail("err", "Подозрительная попытка регистрации", "Вы пытались зарегистрироваться из подозрительного места."); $this->flashFail("err", "Подозрительная попытка регистрации", "Вы пытались зарегистрироваться из подозрительного места.");

View file

@ -111,7 +111,7 @@
<div class="link"> <div class="link">
<a href="/login">вход</a> <a href="/login">вход</a>
</div> </div>
<div class="link"> <div n:if="OPENVK_ROOT_CONF['openvk']['preferences']['registration']['enable']" class="link">
<a href="/reg">регистрация</a> <a href="/reg">регистрация</a>
</div> </div>
<div class="link"> <div class="link">
@ -190,7 +190,7 @@
<input type="hidden" name="jReturnTo" value="{$_SERVER['REQUEST_URI']}" /> <input type="hidden" name="jReturnTo" value="{$_SERVER['REQUEST_URI']}" />
<input type="hidden" name="hash" value="{$csrfToken}" /> <input type="hidden" name="hash" value="{$csrfToken}" />
<input type="submit" value="{_'log_in'}" class="button" style="display: inline-block;" /> <input type="submit" value="{_'log_in'}" class="button" style="display: inline-block;" />
<a href="/reg" class="button" style="display: inline-block;" >{_registration}</a><br><br> <a n:if="OPENVK_ROOT_CONF['openvk']['preferences']['registration']['enable']" href="/reg" class="button" style="display: inline-block;" >{_registration}</a><br><br>
<a href="/restore.pl">Забыли пароль?</a> <a href="/restore.pl">Забыли пароль?</a>
</form> </form>
{/ifset} {/ifset}

View file

@ -21,6 +21,6 @@
</ul> </ul>
<center> <center>
<a class="button" style="margin-right: 5px;cursor: pointer;" href="/login">{_"log_in"}</a> <a class="button" style="margin-right: 5px;cursor: pointer;" href="/login">{_"log_in"}</a>
<a class="button" style="cursor: pointer;" href="/reg">{_"registration"}</a></center> <a n:if="OPENVK_ROOT_CONF['openvk']['preferences']['registration']['enable']" class="button" style="cursor: pointer;" href="/reg">{_"registration"}</a></center>
</div> </div>
{/block} {/block}

View file

@ -18,77 +18,89 @@
{/block} {/block}
{block content} {block content}
<p n:if="!is_null($referer)" align="center"> {if OPENVK_ROOT_CONF['openvk']['preferences']['registration']['enable'] || $referer}
<strong>{$referer->getFullName()}</strong> приглашает вас в OpenVK! <p n:if="!is_null($referer)" align="center">
</p> <strong>{$referer->getFullName()}</strong> приглашает вас в OpenVK!
</p>
<form method="POST" enctype="multipart/form-data">
<table cellspacing="7" cellpadding="0" width="40%" border="0" align="center"> <form method="POST" enctype="multipart/form-data">
<tbody> <table cellspacing="7" cellpadding="0" width="40%" border="0" align="center">
<tr> <tbody>
<td> <tr>
<span>{_"name"}: </span> <td>
</td> <span>{_"name"}: </span>
<td> </td>
<input type="text" name="first_name" required /> <td>
</td> <input type="text" name="first_name" required />
</tr> </td>
<tr> </tr>
<td> <tr>
<span>{_"surname"}: </span> <td>
</td> <span>{_"surname"}: </span>
<td> </td>
<input type="text" name="last_name" required /> <td>
</td> <input type="text" name="last_name" required />
</tr> </td>
<tr> </tr>
<td> <tr>
<span>{_"gender"}: </span> <td>
</td> <span>{_"gender"}: </span>
<td> </td>
{var femalePreferred = OPENVK_ROOT_CONF["openvk"]["preferences"]["femaleGenderPriority"]} <td>
<select name="sex" required> {var femalePreferred = OPENVK_ROOT_CONF["openvk"]["preferences"]["femaleGenderPriority"]}
<option n:attr="selected => !$femalePreferred" value="male">{_"male"}</option> <select name="sex" required>
<option n:attr="selected => $femalePreferred" value="female">{_"female"}</option> <option n:attr="selected => !$femalePreferred" value="male">{_"male"}</option>
</select> <option n:attr="selected => $femalePreferred" value="female">{_"female"}</option>
</td> </select>
</tr> </td>
<tr></tr> </tr>
<tr> <tr></tr>
<td> <tr>
<span>{_"email"}: </span> <td>
</td> <span>{_"email"}: </span>
<td> </td>
<input type="email" name="email" required /> <td>
</td> <input type="email" name="email" required />
</tr> </td>
<tr> </tr>
<td> <tr>
<span>{_"password"}: </span> <td>
</td> <span>{_"password"}: </span>
<td> </td>
<input type="password" name="password" required /> <td>
</td> <input type="password" name="password" required />
</tr> </td>
<tr> </tr>
<td> <tr>
<span>CAPTCHA: </span> <td>
</td> <span>CAPTCHA: </span>
<td> </td>
{captcha_template()|noescape} <td>
</td> {captcha_template()|noescape}
</tr> </td>
<tr> </tr>
<td> <tr>
<td>
</td>
<td> </td>
<input type="hidden" name="hash" value="{$csrfToken}" /> <td>
<input type="submit" value="{_'registration'}" class="button" /> <input type="hidden" name="hash" value="{$csrfToken}" />
<a href="/login">{_"log_in"}</a> <input type="submit" value="{_'registration'}" class="button" />
</td> <a href="/login">{_"log_in"}</a>
</tr> </td>
</tbody> </tr>
</table> </tbody>
</form> </table>
</form>
{else}
<center>
<img src="/assets/packages/static/openvk/img/oof.apng" alt="Регистрация закрыта." style="width: 20%;" />
<p>
Регистрация отключена системным администратором. При возможности попросите приглашение у вашего знакомого, если он зарегистрирован на этом сайте.
{if OPENVK_ROOT_CONF['openvk']['preferences']['registration']['reason']}
<br/><br/><b>{php echo OPENVK_ROOT_CONF['openvk']['preferences']['registration']['reason']}</b>
{/if}
</p>
</center>
{/if}
{/block} {/block}

View file

@ -2,7 +2,6 @@ services:
- openvk\Web\Presenters\AwayPresenter - openvk\Web\Presenters\AwayPresenter
- openvk\Web\Presenters\AboutPresenter - openvk\Web\Presenters\AboutPresenter
- openvk\Web\Presenters\AuthPresenter - openvk\Web\Presenters\AuthPresenter
- openvk\Web\Presenters\AudiosPresenter
- openvk\Web\Presenters\UserPresenter - openvk\Web\Presenters\UserPresenter
- openvk\Web\Presenters\WallPresenter - openvk\Web\Presenters\WallPresenter
- openvk\Web\Presenters\CommentPresenter - openvk\Web\Presenters\CommentPresenter

View file

@ -23,6 +23,9 @@ openvk:
maxViolations: 50 maxViolations: 50
maxViolationsAge: 120 maxViolationsAge: 120
autoban: true autoban: true
registration:
enable: true
reason: "" # reason for disabling registration
support: support:
supportName: "Moderator" supportName: "Moderator"
adminAccount: 1 # Change this ok adminAccount: 1 # Change this ok