From 77d25738b1904c8532b8ecdacdbd1c4f26dbb0e2 Mon Sep 17 00:00:00 2001
From: Focuslinkstech <45756999+Focuslinkstech@users.noreply.github.com>
Date: Thu, 28 Nov 2024 16:16:05 +0100
Subject: [PATCH 1/3] Patch Addon
Add container dark mode
Add Registration Mandatory Fields
---
system/controllers/register.php | 40 ++-
system/controllers/settings.php | 6 +-
ui/ui/app-settings.tpl | 23 ++
ui/ui/customer/register-otp.tpl | 45 ++--
ui/ui/customer/register.tpl | 34 ++-
ui/ui/sections/header.tpl | 438 ++++++++++++++++----------------
6 files changed, 316 insertions(+), 270 deletions(-)
diff --git a/system/controllers/register.php b/system/controllers/register.php
index b8550dc1..8d78df0f 100644
--- a/system/controllers/register.php
+++ b/system/controllers/register.php
@@ -27,24 +27,24 @@ switch ($do) {
$address = _post('address');
// Separate phone number input if OTP is required
- if ($config['sms_otp_registration'] == 'yes') {
- $phone_number = alphanumeric(_post('phone_number'), "+_.@-");
- } else {
- $phone_number = $username; // When OTP is not required, treat username as phone number
- }
+ $phone_number = ($config['sms_otp_registration'] == 'yes') ? alphanumeric(_post('phone_number'), "+_.@-") : $username;
$msg = '';
if (Validator::Length($username, 35, 2) == false) {
- $msg .= 'Username should be between 3 to 55 characters' . ' ';
+ $msg .= "Username should be between 3 to 55 characters ";
}
- if (Validator::Length($fullname, 36, 2) == false) {
- $msg .= 'Full Name should be between 3 to 25 characters' . ' ';
+ if ($config['man_fields_fname'] == 'yes') {
+ if (Validator::Length($fullname, 36, 2) == false) {
+ $msg .= "Full Name should be between 3 to 25 characters ";
+ }
}
if (!Validator::Length($password, 35, 2)) {
- $msg .= 'Password should be between 3 to 35 characters' . ' ';
+ $msg .= "Password should be between 3 to 35 characters ";
}
- if (!Validator::Email($email)) {
- $msg .= 'Email is not Valid ';
+ if ($config['man_fields_email'] == 'yes') {
+ if (!Validator::Email($email)) {
+ $msg .= 'Email is not Valid ';
+ }
}
if ($password != $cpassword) {
$msg .= Lang::T('Passwords does not match') . ' ';
@@ -52,7 +52,7 @@ switch ($do) {
// OTP verification if OTP is enabled
if ($_c['sms_otp_registration'] == 'yes') {
- $otpPath .= sha1($phone_number . $db_pass) . ".txt";
+ $otpPath .= sha1("$phone_number$db_pass") . ".txt";
run_hook('validate_otp'); #HOOK
// Expire after 10 minutes
if (file_exists($otpPath) && time() - filemtime($otpPath) > 1200) {
@@ -171,13 +171,13 @@ switch ($do) {
} else {
$otp = rand(100000, 999999);
file_put_contents($otpPath, $otp);
- if($config['phone_otp_type'] == 'whatsapp'){
- Message::sendWhatsapp($phone_number, $config['CompanyName'] . "\n\n".Lang::T("Registration code")."\n$otp");
- }else if($config['phone_otp_type'] == 'both'){
- Message::sendWhatsapp($phone_number, $config['CompanyName'] . "\n\n".Lang::T("Registration code")."\n$otp");
- Message::sendSMS($phone_number, $config['CompanyName'] . "\n\n".Lang::T("Registration code")."\n$otp");
- }else{
- Message::sendSMS($phone_number, $config['CompanyName'] . "\n\n".Lang::T("Registration code")."\n$otp");
+ if ($config['phone_otp_type'] == 'whatsapp') {
+ Message::sendWhatsapp($phone_number, $config['CompanyName'] . "\n\n" . Lang::T("Registration code") . "\n$otp");
+ } else if ($config['phone_otp_type'] == 'both') {
+ Message::sendWhatsapp($phone_number, $config['CompanyName'] . "\n\n" . Lang::T("Registration code") . "\n$otp");
+ Message::sendSMS($phone_number, $config['CompanyName'] . "\n\n" . Lang::T("Registration code") . "\n$otp");
+ } else {
+ Message::sendSMS($phone_number, $config['CompanyName'] . "\n\n" . Lang::T("Registration code") . "\n$otp");
}
$ui->assign('phone_number', $phone_number);
$ui->assign('notify', 'Registration code has been sent to your phone');
@@ -204,5 +204,3 @@ switch ($do) {
}
break;
}
-
-?>
diff --git a/system/controllers/settings.php b/system/controllers/settings.php
index 698101b6..135988e4 100644
--- a/system/controllers/settings.php
+++ b/system/controllers/settings.php
@@ -133,7 +133,7 @@ switch ($action) {
$d->save();
}
}
- if(empty($config['mikrotik_sms_command'])){
+ if (empty($config['mikrotik_sms_command'])) {
$config['mikrotik_sms_command'] = "/tool sms send";
}
$ui->assign('template_files', $templates);
@@ -188,6 +188,10 @@ switch ($action) {
}
}
// Save all settings including tax system
+ $_POST['man_fields_email'] = isset($_POST['man_fields_email']) ? 'yes' : 'no';
+ $_POST['man_fields_fname'] = isset($_POST['man_fields_fname']) ? 'yes' : 'no';
+ $_POST['man_fields_address'] = isset($_POST['man_fields_address']) ? 'yes' : 'no';
+ $_POST['man_fields_custom'] = isset($_POST['man_fields_custom']) ? 'yes' : 'no';
$enable_session_timeout = isset($_POST['enable_session_timeout']) ? 1 : 0;
$_POST['enable_session_timeout'] = $enable_session_timeout;
foreach ($_POST as $key => $value) {
diff --git a/ui/ui/app-settings.tpl b/ui/ui/app-settings.tpl
index 6d4d030d..a600f2df 100644
--- a/ui/ui/app-settings.tpl
+++ b/ui/ui/app-settings.tpl
@@ -368,6 +368,29 @@
{Lang::T('The method which OTP will be sent to user')}
{Lang::T('For Registration and Update Phone Number')}
+
+ {Lang::T('Registration Mandatory Fields')}:
+
+
+ {Lang::T('Email')}
+
+
+
+ {Lang::T('Full Name')}
+
+
+
+ {Lang::T('Address')}
+
+
+
+ {Lang::T('Custom Fields')}
+
+
{Lang::T('Save Changes')}
diff --git a/ui/ui/customer/register-otp.tpl b/ui/ui/customer/register-otp.tpl
index 9ae84f0b..3253509b 100644
--- a/ui/ui/customer/register-otp.tpl
+++ b/ui/ui/customer/register-otp.tpl
@@ -33,26 +33,33 @@
placeholder="{Lang::T('Verification Code')}" name="otp_code">
{if $_c['photo_register'] == 'yes'}
-
- {Lang::T('Photo')}
-
-
+
+ {Lang::T('Photo')}
+
+
{/if}
+ {if $_c['man_fields_fname'] neq 'no'}
{Lang::T('Full Name')}
+ {/if}
+ {if $_c['man_fields_address'] neq 'no'}
{Lang::T('Email')}
+ {/if}
+ {if $_c['man_fields_address'] neq 'no'}
{Lang::T('Address')}
+ {if $_c['man_fields_custom'] neq 'no'}
{$customFields}
+ {/if}
@@ -114,21 +121,21 @@
{if $_c['tawkto'] != ''}
-
-
-
+
+
+
{/if}
{include file="customer/footer-public.tpl"}
\ No newline at end of file
diff --git a/ui/ui/customer/register.tpl b/ui/ui/customer/register.tpl
index b6827ad3..df87e2dc 100644
--- a/ui/ui/customer/register.tpl
+++ b/ui/ui/customer/register.tpl
@@ -19,49 +19,57 @@
{if $_c['photo_register'] == 'yes'}
-
- {Lang::T('Photo')}
-
-
+
+ {Lang::T('Photo')}
+
+
{/if}
+ {if $_c['man_fields_fname'] neq 'no'}
{Lang::T('Full Name')}
+ {/if}
+ {if $_c['man_fields_email'] neq 'no'}
{Lang::T('Email')}
+ {/if}
+ {if $_c['man_fields_address'] neq 'no'}
{Lang::T('Address')}
+ {/if}
+ {if $_c['man_fields_custom'] neq 'no'}
{$customFields}
+ {/if}
diff --git a/ui/ui/sections/header.tpl b/ui/ui/sections/header.tpl
index f3b7c9ce..1d8ad302 100644
--- a/ui/ui/sections/header.tpl
+++ b/ui/ui/sections/header.tpl
@@ -173,6 +173,7 @@
background-color: #efeb0a;
border-color: #efeb0a;
}
+
.panel-cron-danger>.panel-heading {
border-bottom-right-radius: 21px;
border-bottom-left-radius: 21px;
@@ -276,7 +277,7 @@
font-weight: bold;
}
- .box.box-solid.box-primary > .box-header .btn {
+ .box.box-solid.box-primary>.box-header .btn {
color: inherit;
}
@@ -1136,12 +1137,17 @@
border-radius: 4px;
}
+ .dark-mode .container {
+ background-color: #353638;
+
+ }
+
/* Dark Mode - Select2 Dropdown ends here */
/* dark mode styles start ends here */
{if isset($xheader)}
- {$xheader}
+ {$xheader}
{/if}
@@ -1232,83 +1238,83 @@
{$_MENU_AFTER_DASHBOARD}
{if !in_array($_admin['user_type'],['Report'])}
-
- {$_MENU_AFTER_CUSTOMERS}
-
+
+ {$_MENU_AFTER_CUSTOMERS}
+
{/if}
{$_MENU_AFTER_SERVICES}
{if in_array($_admin['user_type'],['SuperAdmin','Admin'])}
-
+
{/if}
{$_MENU_AFTER_PLANS}