mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
Add some new hooks for the account/create page
Also moved some account-create text to plugins
This commit is contained in:
parent
d252138867
commit
72c79e005a
2
.gitignore
vendored
2
.gitignore
vendored
@ -28,4 +28,6 @@ system/logs/*
|
|||||||
plugins/*
|
plugins/*
|
||||||
!plugins/.htaccess
|
!plugins/.htaccess
|
||||||
!plugins/example.json
|
!plugins/example.json
|
||||||
|
!plugins/account-create-hint.json
|
||||||
|
!plugins/account-create-hint
|
||||||
landing
|
landing
|
||||||
|
17
plugins/account-create-hint.json
Normal file
17
plugins/account-create-hint.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "create-account-hint",
|
||||||
|
"description": "This plugin display text 'To play on Forgotten you need an account. All you have to do to create your new account is to enter an account name, password, country and your email address. Also you have to agree to the terms presented below. If you have done so, your account name will be shown on the following page and your account password will be sent to your email address along with further instructions. If you do not receive the email with your password, please check your spam filter.' on the create account page. <strong>Be careful when uninstalling this!</strong>",
|
||||||
|
"version": "1.0",
|
||||||
|
"author": "slawkens",
|
||||||
|
"contact": "slawkens@gmail.com",
|
||||||
|
"hooks": {
|
||||||
|
"create-account-hint": {
|
||||||
|
"type": "ACCOUNT_CREATE_BEFORE_FORM",
|
||||||
|
"file": "plugins/account-create-hint/hint.php"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"uninstall": [
|
||||||
|
"plugins/account-create-hint.json",
|
||||||
|
"plugins/account-create-hint"
|
||||||
|
]
|
||||||
|
}
|
3
plugins/account-create-hint/hint.html.twig
Normal file
3
plugins/account-create-hint/hint.html.twig
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
To play on {{ config.lua.serverName }} you need an account.
|
||||||
|
All you have to do to create your new account is to enter an account {% if constant('USE_ACCOUNT_NAME') %}name{% else %}number{% endif %}, password{% if config.recaptcha_enabled %}, confirm reCAPTCHA{% endif %}{% if config.account_country %}, country{% endif %} and your email address.
|
||||||
|
Also you have to agree to the terms presented below. If you have done so, your account {% if constant('USE_ACCOUNT_NAME') %}name{% else %}number{% endif %} will be shown on the following page and your account password will be sent to your email address along with further instructions. If you do not receive the email with your password, please check your spam filter.<br/><br/>
|
15
plugins/account-create-hint/hint.php
Normal file
15
plugins/account-create-hint/hint.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* account-create index.php
|
||||||
|
*
|
||||||
|
* @package MyAAC
|
||||||
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
|
* @copyright 2020 MyAAC
|
||||||
|
* @link https://my-aac.org
|
||||||
|
*/
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
|
global $twig_loader;
|
||||||
|
$twig_loader->prependPath(BASE . 'plugins/account-create');
|
||||||
|
|
||||||
|
$twig->display('hint.html.twig');
|
@ -24,8 +24,27 @@ define('HOOK_CHARACTERS_AFTER_CHARACTERS', 12);
|
|||||||
define('HOOK_LOGIN', 13);
|
define('HOOK_LOGIN', 13);
|
||||||
define('HOOK_LOGIN_ATTEMPT', 14);
|
define('HOOK_LOGIN_ATTEMPT', 14);
|
||||||
define('HOOK_LOGOUT', 15);
|
define('HOOK_LOGOUT', 15);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_BEFORE_FORM', 16);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_BEFORE_BOXES', 17);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_1', 18);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_2', 19);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_AFTER_BOXES', 20);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_BEFORE_ACCOUNT', 21);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_AFTER_ACCOUNT', 22);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_AFTER_EMAIL', 23);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_AFTER_COUNTRY', 24);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_AFTER_PASSWORDS', 25);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_AFTER_RECAPTCHA', 26);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_BEFORE_CHARACTER_NAME', 27);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_AFTER_CHARACTER_NAME', 28);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_AFTER_SEX', 29);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_AFTER_VOCATION', 30);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_AFTER_TOWNS', 31);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_BEFORE_SUBMIT_BUTTON', 32);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_AFTER_FORM', 33);
|
||||||
|
define('HOOK_ACCOUNT_CREATE_AFTER_SUBMIT', 34);
|
||||||
define('HOOK_FIRST', HOOK_STARTUP);
|
define('HOOK_FIRST', HOOK_STARTUP);
|
||||||
define('HOOK_LAST', HOOK_LOGOUT);
|
define('HOOK_LAST', HOOK_ACCOUNT_CREATE_AFTER_SUBMIT);
|
||||||
|
|
||||||
require_once LIBS . 'plugins.php';
|
require_once LIBS . 'plugins.php';
|
||||||
class Hook
|
class Hook
|
||||||
|
@ -121,6 +121,24 @@ if($save)
|
|||||||
if(!isset($_POST['accept_rules']) || $_POST['accept_rules'] !== 'true')
|
if(!isset($_POST['accept_rules']) || $_POST['accept_rules'] !== 'true')
|
||||||
$errors['accept_rules'] = 'You have to agree to the ' . $config['lua']['serverName'] . ' Rules in order to create an account!';
|
$errors['accept_rules'] = 'You have to agree to the ' . $config['lua']['serverName'] . ' Rules in order to create an account!';
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
'account' => $account_db,
|
||||||
|
'email' => $email,
|
||||||
|
'country' => $country,
|
||||||
|
'password' => $password,
|
||||||
|
'password2' => $password2,
|
||||||
|
'accept_rules' => isset($_POST['accept_rules']) ? $_POST['accept_rules'] === 'true' : false,
|
||||||
|
);
|
||||||
|
|
||||||
|
if(USE_ACCOUNT_NAME) {
|
||||||
|
$params['account_name'] = $_POST['account'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$params['account_id'] = $_POST['account'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$hooks->trigger(HOOK_ACCOUNT_CREATE_AFTER_SUBMIT, $params);
|
||||||
|
|
||||||
if(config('account_create_character_create')) {
|
if(config('account_create_character_create')) {
|
||||||
$character_name = isset($_POST['name']) ? stripslashes(ucwords(strtolower($_POST['name']))) : null;
|
$character_name = isset($_POST['name']) ? stripslashes(ucwords(strtolower($_POST['name']))) : null;
|
||||||
$character_sex = isset($_POST['sex']) ? (int)$_POST['sex'] : null;
|
$character_sex = isset($_POST['sex']) ? (int)$_POST['sex'] : null;
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
To play on {{ config.lua.serverName }} you need an account.
|
{{ hook('HOOK_ACCOUNT_CREATE_BEFORE_FORM') }}
|
||||||
All you have to do to create your new account is to enter an account {% if constant('USE_ACCOUNT_NAME') %}name{% else %}number{% endif %}, password{% if config.recaptcha_enabled %}, confirm reCAPTCHA{% endif %}{% if config.account_country %}, country{% endif %} and your email address.
|
|
||||||
Also you have to agree to the terms presented below. If you have done so, your account {% if constant('USE_ACCOUNT_NAME') %}name{% else %}number{% endif %} will be shown on the following page and your account password will be sent to your email address along with further instructions. If you do not receive the email with your password, please check your spam filter.<br/><br/>
|
|
||||||
<form action="{{ getLink('account/create') }}" method="post" id="createaccount">
|
<form action="{{ getLink('account/create') }}" method="post" id="createaccount">
|
||||||
<div class="TableContainer" >
|
<div class="TableContainer" >
|
||||||
<table class="Table5" cellpadding="0" cellspacing="0" >
|
<table class="Table5" cellpadding="0" cellspacing="0" >
|
||||||
@ -21,6 +19,7 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
<td>
|
<td>
|
||||||
<div class="InnerTableContainer" >
|
<div class="InnerTableContainer" >
|
||||||
<table style="width:100%;" >
|
<table style="width:100%;" >
|
||||||
|
{{ hook('HOOK_ACCOUNT_CREATE_BEFORE_BOXES') }}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<div class="TableShadowContainerRightTop"> <div class="TableShadowRightTop" style="background-image:url({{ template_path }}/images/global/content/table-shadow-rt.gif);"></div></div>
|
<div class="TableShadowContainerRightTop"> <div class="TableShadowRightTop" style="background-image:url({{ template_path }}/images/global/content/table-shadow-rt.gif);"></div></div>
|
||||||
@ -28,6 +27,9 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
<div class="TableContentContainer">
|
<div class="TableContentContainer">
|
||||||
<table class="TableContent" width="100%" style="border:1px solid #faf0d7;">
|
<table class="TableContent" width="100%" style="border:1px solid #faf0d7;">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
|
{{ hook('HOOK_ACCOUNT_CREATE_BEFORE_ACCOUNT') }}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="LabelV" style="width: 150px">
|
<td class="LabelV" style="width: 150px">
|
||||||
<span{% if errors.account is defined %} class="red"{% endif %}>Account {% if constant('USE_ACCOUNT_NAME') %}Name{% else %}Number{% endif %}:</span>
|
<span{% if errors.account is defined %} class="red"{% endif %}>Account {% if constant('USE_ACCOUNT_NAME') %}Name{% else %}Number{% endif %}:</span>
|
||||||
@ -38,6 +40,7 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td></td><td><span id="account_error" class="FormFieldError">{% if errors.account is defined %}{{ errors.account }}{% endif %}</span></td></tr>
|
<tr><td></td><td><span id="account_error" class="FormFieldError">{% if errors.account is defined %}{{ errors.account }}{% endif %}</span></td></tr>
|
||||||
|
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_ACCOUNT') }}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="LabelV" style="width: 150px">
|
<td class="LabelV" style="width: 150px">
|
||||||
<span{% if errors.email is defined %} class="red"{% endif %}>Email Address:</span>
|
<span{% if errors.email is defined %} class="red"{% endif %}>Email Address:</span>
|
||||||
@ -47,7 +50,12 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
<img id="email_indicator" src="images/global/general/{% if not save or errors.email is defined %}n{% endif %}ok.gif" style="display: none;" />
|
<img id="email_indicator" src="images/global/general/{% if not save or errors.email is defined %}n{% endif %}ok.gif" style="display: none;" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td></td><td><span id="email_error" class="FormFieldError">{% if errors.email is defined %}{{ errors.email }}{% endif %}</span></td></tr>
|
<tr>
|
||||||
|
<td></td><td><span id="email_error" class="FormFieldError">{% if errors.email is defined %}{{ errors.email }}{% endif %}</span></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_EMAIL') }}
|
||||||
|
|
||||||
{% if config.account_country %}
|
{% if config.account_country %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="LabelV" style="width: 150px">
|
<td class="LabelV" style="width: 150px">
|
||||||
@ -66,6 +74,9 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
<tr><td></td><td><span class="FormFieldError">{{ errors.country }}</span></td></tr>
|
<tr><td></td><td><span class="FormFieldError">{{ errors.country }}</span></td></tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_COUNTRY') }}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="LabelV" style="width: 150px">
|
<td class="LabelV" style="width: 150px">
|
||||||
<span{% if errors.password is defined %} class="red"{% endif %}>Password:</span>
|
<span{% if errors.password is defined %} class="red"{% endif %}>Password:</span>
|
||||||
@ -86,6 +97,9 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td></td><td><span id="password2_error" class="FormFieldError">{% if errors.password is defined %}{{ errors.password }}{% endif %}</span></td></tr>
|
<tr><td></td><td><span id="password2_error" class="FormFieldError">{% if errors.password is defined %}{{ errors.password }}{% endif %}</span></td></tr>
|
||||||
|
|
||||||
|
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_PASSWORDS') }}
|
||||||
|
|
||||||
{% if config.recaptcha_enabled %}
|
{% if config.recaptcha_enabled %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="LabelV" style="width: 150px">
|
<td class="LabelV" style="width: 150px">
|
||||||
@ -99,6 +113,8 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
<tr><td></td><td><span class="FormFieldError">{{ errors.verification }}</span></td></tr>
|
<tr><td></td><td><span class="FormFieldError">{{ errors.verification }}</span></td></tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_RECAPTCHA') }}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -107,6 +123,9 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
<div class="TableBottomShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-bm.gif);"> <div class="TableBottomLeftShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-bl.gif);"></div> <div class="TableBottomRightShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-br.gif);"></div> </div></div>
|
<div class="TableBottomShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-bm.gif);"> <div class="TableBottomLeftShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-bl.gif);"></div> <div class="TableBottomRightShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-br.gif);"></div> </div></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
{{ hook('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_1') }}
|
||||||
|
|
||||||
{% if (not config.mail_enabled or not config.account_mail_verify) and config.account_create_character_create %}
|
{% if (not config.mail_enabled or not config.account_mail_verify) and config.account_create_character_create %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
@ -117,6 +136,9 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
<div class="TableContentContainer">
|
<div class="TableContentContainer">
|
||||||
<table class="TableContent" width="100%" style="border:1px solid #faf0d7;">
|
<table class="TableContent" width="100%" style="border:1px solid #faf0d7;">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
|
{{ hook('HOOK_ACCOUNT_CREATE_BEFORE_CHARACTER_NAME') }}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="LabelV" style="width: 150px">
|
<td class="LabelV" style="width: 150px">
|
||||||
<span{% if errors.name is defined %} class="red"{% endif %}>Character Name:</span>
|
<span{% if errors.name is defined %} class="red"{% endif %}>Character Name:</span>
|
||||||
@ -134,6 +156,8 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_CHARACTER_NAME') }}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="LabelV" style="width: 150px">
|
<td class="LabelV" style="width: 150px">
|
||||||
<span{% if errors.sex is defined %} class="red"{% endif %}>Sex:</span>
|
<span{% if errors.sex is defined %} class="red"{% endif %}>Sex:</span>
|
||||||
@ -165,6 +189,9 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
<span id="sex_error" class="FormFieldError">{% if errors.sex is defined %}{{ errors.sex }}{% endif %}</span>
|
<span id="sex_error" class="FormFieldError">{% if errors.sex is defined %}{{ errors.sex }}{% endif %}</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_SEX') }}
|
||||||
|
|
||||||
{% if config.character_samples|length > 1 %}
|
{% if config.character_samples|length > 1 %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="LabelV" style="width: 150px">
|
<td class="LabelV" style="width: 150px">
|
||||||
@ -195,6 +222,9 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_VOCATION') }}
|
||||||
|
|
||||||
{% if config.character_towns|length > 1 %}
|
{% if config.character_towns|length > 1 %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="LabelV" style="width: 150px">
|
<td class="LabelV" style="width: 150px">
|
||||||
@ -219,6 +249,9 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_TOWNS') }}
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -232,6 +265,9 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{{ hook('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_2') }}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<div class="TableShadowContainerRightTop">
|
<div class="TableShadowContainerRightTop">
|
||||||
@ -266,6 +302,9 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_BOXES') }}
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -273,6 +312,7 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
|
{{ hook('HOOK_ACCOUNT_CREATE_BEFORE_SUBMIT_BUTTON') }}
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr align="center">
|
<tr align="center">
|
||||||
<td>
|
<td>
|
||||||
@ -288,4 +328,5 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
|
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_FORM') }}
|
||||||
<script type="text/javascript" src="tools/check_name.js"></script>
|
<script type="text/javascript" src="tools/check_name.js"></script>
|
Loading…
x
Reference in New Issue
Block a user