Browse Source

Ticket #3399 - Join/Login blocks, Forms, etc.

AntonLV 5 năm trước cách đây
mục cha
commit
3931011304

+ 5 - 3
modules/boonex/artificer/data/template/system/auth.html

@@ -1,9 +1,11 @@
 <div class="sys-auth-block __class_container__ flex flex-wrap justify-between -mx-1">
     <bx_repeat:buttons>
         <div class="sys-auth __class__ flex w-1/2 mb-2">
-            <a class="bx-btn flex items-center w-full mx-1" href="__href__"
-                <bx_if:show_onclick> onclick="__onclick__"</bx_if:show_onclick> title="__title_alt__">
-                <bx_if:show_icon><i class="sys-icon __icon__ sys-colored"></i></bx_if:show_icon><bx_if:show_title><u>__title__</u></bx_if:show_title>
+            <a class="group inline-flex items-center justify-center w-full mx-1 px-4 py-2 border border-gray-300 dark:border-gray-700 shadow-sm hover:shadow-md text-sm font-medium rounded-md text-gray-700 dark:text-gray-300 dark:hover:text-white hover:text-gray-800 bg-white dark:bg-gray-800 dark:hover:bg-gray-700 hover:bg-gray-50" href="__href__" <bx_if:show_onclick> onclick="__onclick__"</bx_if:show_onclick> title="__title_alt__">
+                <bx_if:show_icon>
+                    <span class="sys-auth-icon flex items-center justify-center h-5 w-5"><i class="sys-icon __icon__ sys-colored"></i></span>
+                </bx_if:show_icon>
+                <bx_if:show_title><span class="sys-auth-text ml-2">__title__</span></bx_if:show_title>
             </a>
         </div>
     </bx_repeat:buttons>

+ 6 - 0
modules/boonex/artificer/data/template/system/block_join.html

@@ -0,0 +1,6 @@
+<bx_if:show_auth>__content__</bx_if:show_auth>
+<bx_if:show_form>__content__</bx_if:show_form>
+<bx_if:show_login>
+    <hr class="bx-def-hr my-2" />
+    <div class="text-sm font-normal text-gray-700 dark:text-gray-300"><bx_text:_sys_txt_join_description_question /> <a class="text-blue-600 hover:text-blue-700 dark:text-blue-500 dark:hover:text-blue-600" href="__url__"><bx_text:_sys_txt_join_description_action /></a></div>
+</bx_if:show_login>

+ 28 - 0
modules/boonex/artificer/data/template/system/block_login.html

@@ -0,0 +1,28 @@
+__custom_html_before__
+<bx_if:show_auth>__content__</bx_if:show_auth>
+<bx_if:show_form>__content__</bx_if:show_form>
+__custom_html_after__
+<bx_if:show_join>
+    <hr class="bx-def-hr my-2" />
+    <div class="text-sm font-normal text-gray-700 dark:text-gray-300">
+        <bx_text:_sys_txt_login_description_question /> <a class="text-blue-600 hover:text-blue-700 dark:text-blue-500 dark:hover:text-blue-600" href="__url__"><bx_text:_sys_txt_login_description_action /></a>
+    </div>
+</bx_if:show_join>
+<bx_if:show_js_code>
+    <script>
+        (bx_login_init_ajax_form = function () {
+            $('#sys-form-login').ajaxForm({
+                dataType: 'json',
+                success: function (oData) {
+                    if ('undefined' !== typeof(oData['res']) && 'OK' == oData['res']) {
+                        location.reload();
+                    }
+                    else if ('undefined' !== typeof(oData['form'])) {
+                        $('#sys-form-login').replaceWith(oData['form']);
+                        bx_login_init_ajax_form();
+                    }
+                }
+            });
+        })();
+    </script>
+</bx_if:show_js_code>

+ 1 - 1
modules/boonex/artificer/data/template/system/cover.html

@@ -17,7 +17,7 @@
             </div>
             <div class=" relative  text-center md:max-w-2xl md:mx-auto">
               <div>
-                <h1 class="text-4xl  sm:text-5xl xl:text-6xl tracking-tight  font-bold text-gray-800 dark:text-white ">
+                <h1 class="text-4xl font-bold tracking-tight text-gray-900 dark:text-gray-50">
                   <span class="block pb-1 relative">__title__</span>
                   <span class="block pb-1  bg-clip-text text-transparent bg-gradient-to-r from-red-500 to-blue-500 "></span>
                 </h1>

+ 8 - 4
modules/boonex/artificer/template/css/tailwind.css

@@ -75,15 +75,19 @@
 
 
     /* Common elements: Forms */
-    .bx-form-required,
-    .bx-form-warn {
-        @apply text-red-400;
+    form {
+        @apply text-sm font-normal text-gray-700 dark:text-gray-300;
     }
 
-    form .bx-form-element a {
+    form a {
         @apply font-normal text-blue-600 hover:text-blue-700 dark:text-blue-500 dark:hover:text-blue-600;
     }
 
+    .bx-form-required,
+    .bx-form-warn {
+        @apply text-red-400;
+    }
+
 
     /* Common elements: Popups */
     .bx-popup-wrapper {

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
modules/boonex/artificer/template/css/tailwind.min.css


+ 10 - 8
modules/boonex/english/data/langs/system/en.xml

@@ -3368,19 +3368,21 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_txt_form_submission_error_csrf_expired"><![CDATA[Token expired. Please try again.]]></string>
 
     <string name="_sys_txt_homepage_cover"><![CDATA[Unity is strength... when there is teamwork and collaboration, wonderful things can be achieved.<br /><button class="bx-btn bx-hide-when-logged-in bx-def-margin-top" onclick="document.location='{0}'">Join Now!</button>]]></string>
-	<string name="_sys_txt_login_2fa_description"><![CDATA[Two-factor authentication is enabled, please specify the phone number to send verification code to.]]></string>
+    <string name="_sys_txt_login_2fa_description"><![CDATA[Two-factor authentication is enabled, please specify the phone number to send verification code to.]]></string>
 	
-	<string name="_sys_txt_login_2fa_sms_text"><![CDATA[Your verification code is {0}.]]></string>
-	<string name="_sys_txt_login_2fa_sms_error_occured"><![CDATA[An error occurred, please report error to the site administrator.]]></string>
-    <string name="_sys_txt_join_description"><![CDATA[Already a member? <a href="{0}">Log in.</a>]]></string>
-	<string name="_sys_txt_login_description"><![CDATA[Not a member yet? <a href="{0}">Sign up.</a>]]></string>
-	<string name="_sys_txt_login_error"><![CDATA[Entered email or password is incorrect. Please try again.]]></string>
-  <string name="_sys_txt_login_locked"><![CDATA[Your account is locked and needs to be unlocked using <a href="{0}">forgot password page</a>.]]></string>
+    <string name="_sys_txt_login_2fa_sms_text"><![CDATA[Your verification code is {0}.]]></string>
+    <string name="_sys_txt_login_2fa_sms_error_occured"><![CDATA[An error occurred, please report error to the site administrator.]]></string>
+    <string name="_sys_txt_join_description_question"><![CDATA[Already a member?]]></string>
+    <string name="_sys_txt_join_description_action"><![CDATA[Log in.]]></string>
+    <string name="_sys_txt_login_description_question"><![CDATA[Not a member yet?]]></string>
+    <string name="_sys_txt_login_description_action"><![CDATA[Sign up.]]></string>
+    <string name="_sys_txt_login_error"><![CDATA[Entered email or password is incorrect. Please try again.]]></string>
+    <string name="_sys_txt_login_locked"><![CDATA[Your account is locked and needs to be unlocked using <a href="{0}">forgot password page</a>.]]></string>
   
     <string name="_sys_txt_following_counter"><![CDATA[Following: {0}]]></string>
     <string name="_sys_txt_followers_counter"><![CDATA[Followers: {0}]]></string>
     <string name="_sys_txt_friends_counter"><![CDATA[Friends: {0}]]></string>
-	<string name="_sys_txt_login_invalid_role"><![CDATA[Access denied]]></string>
+    <string name="_sys_txt_login_invalid_role"><![CDATA[Access denied]]></string>
     <string name="_sys_txt_my_profiles"><![CDATA[Create a new profile]]></string>
     <string name="_sys_txt_new_picture"><![CDATA[New Picture]]></string>
     <string name="_sys_txt_not_found"><![CDATA[Not found]]></string>

+ 18 - 0
modules/boonex/payment/classes/BxPaymentProviderStripeV3.php

@@ -494,6 +494,24 @@ class BxPaymentProviderStripeV3 extends BxPaymentProviderStripeBasic implements
             'sClientEmail' => $sClientEmail,
         ), $aParams)), $sJsMethod);
     }
+
+    protected function _processException($sMessage, &$oException)
+    {
+        if(method_exists($oException, 'getError')) {
+            $sError = $oException->getError()->message;
+            $aError = $oException->getError()->toArray();
+        }
+        else { 
+            $sError = $oException->getMessage();
+            $aError = array();
+        }
+
+        $this->log($sMessage . $sError);
+        if(!empty($aError))
+            $this->log($aError);
+
+        return false;
+    }
 }
 
 /** @} */

+ 9 - 7
modules/boonex/russian/data/langs/system/ru.xml

@@ -3336,16 +3336,18 @@
 
     <string name="_sys_txt_homepage_cover"><![CDATA[Сплоченность людей — нерушимая крепость.<br /><button class="bx-btn bx-hide-when-logged-in bx-def-margin-top" onclick="document.location='{0}'">Присоединиться!</button>]]></string>
     <string name="_sys_txt_login_2fa_description"><![CDATA[Двухэтапная авторизация включена. В дополнении к email-у и паролю, Вам нужно будет ввести код проверки, который мы вышлем вам в SMS.]]></string>
-	<string name="_sys_txt_login_2fa_sms_text"><![CDATA[Ваш код проверки {0}.]]></string>
-	<string name="_sys_txt_login_2fa_sms_error_occured"><![CDATA[Произошла ошибка, пожалуйста, уведомите о ней администратора сайта.]]></string>
-	<string name="_sys_txt_join_description"><![CDATA[Уже зарегистрировались? <a href="{0}">Заходите.</a>]]></string>
-	<string name="_sys_txt_login_description"><![CDATA[Ещё нет аккаунта? <a href="{0}">Зарегистрируйтесь.</a>]]></string>
-	<string name="_sys_txt_login_error"><![CDATA[Введённый email или пароль неправильны. Пожалуйста, попытайтесь снова.]]></string>
-  <string name="_sys_txt_login_locked"><![CDATA[Ваш аккаунт заблокирован, для разблокировки, пожалуйста, используйте  <a href="{0}">страницу сброса пароля</a>.]]></string>
+    <string name="_sys_txt_login_2fa_sms_text"><![CDATA[Ваш код проверки {0}.]]></string>
+    <string name="_sys_txt_login_2fa_sms_error_occured"><![CDATA[Произошла ошибка, пожалуйста, уведомите о ней администратора сайта.]]></string>
+    <string name="_sys_txt_join_description_question"><![CDATA[Уже зарегистрировались?]]></string>
+    <string name="_sys_txt_join_description_action"><![CDATA[Заходите.]]></string>
+    <string name="_sys_txt_login_description_question"><![CDATA[Ещё нет аккаунта?]]></string>
+    <string name="_sys_txt_login_description_action"><![CDATA[Зарегистрируйтесь.]]></string>
+    <string name="_sys_txt_login_error"><![CDATA[Введённый email или пароль неправильны. Пожалуйста, попытайтесь снова.]]></string>
+    <string name="_sys_txt_login_locked"><![CDATA[Ваш аккаунт заблокирован, для разблокировки, пожалуйста, используйте  <a href="{0}">страницу сброса пароля</a>.]]></string>
     <string name="_sys_txt_following_counter"><![CDATA[Подписки: {0}]]></string>
     <string name="_sys_txt_followers_counter"><![CDATA[Подписчики: {0}]]></string>
     <string name="_sys_txt_friends_counter"><![CDATA[Друзья: {0}]]></string>
-	<string name="_sys_txt_login_invalid_role"><![CDATA[Доступ запрещён]]></string>
+    <string name="_sys_txt_login_invalid_role"><![CDATA[Доступ запрещён]]></string>
     <string name="_sys_txt_my_profiles"><![CDATA[Создать новый профайл]]></string>
     <string name="_sys_txt_new_picture"><![CDATA[Новая картинка]]></string>
     <string name="_sys_txt_not_found"><![CDATA[Не найдено]]></string>

+ 6 - 0
template/block_join.html

@@ -0,0 +1,6 @@
+<bx_if:show_auth>__content__</bx_if:show_auth>
+<bx_if:show_form>__content__</bx_if:show_form>
+<bx_if:show_login>
+    <hr class="bx-def-hr bx-def-margin-sec-topbottom" />
+    <div><bx_text:_sys_txt_join_description_question /> <a href="__url__"><bx_text:_sys_txt_join_description_action /></a></div>
+</bx_if:show_login>

+ 28 - 0
template/block_login.html

@@ -0,0 +1,28 @@
+__custom_html_before__
+<bx_if:show_auth>__content__</bx_if:show_auth>
+<bx_if:show_form>__content__</bx_if:show_form>
+__custom_html_after__
+<bx_if:show_join>
+    <hr class="bx-def-hr bx-def-margin-sec-topbottom" />
+    <div>
+        <bx_text:_sys_txt_login_description_question /> <a href="__url__"><bx_text:_sys_txt_login_description_action /></a>
+    </div>
+</bx_if:show_join>
+<bx_if:show_js_code>
+    <script>
+        (bx_login_init_ajax_form = function () {
+            $('#sys-form-login').ajaxForm({
+                dataType: 'json',
+                success: function (oData) {
+                    if ('undefined' !== typeof(oData['res']) && 'OK' == oData['res']) {
+                        location.reload();
+                    }
+                    else if ('undefined' !== typeof(oData['form'])) {
+                        $('#sys-form-login').replaceWith(oData['form']);
+                        bx_login_init_ajax_form();
+                    }
+                }
+            });
+        })();
+    </script>
+</bx_if:show_js_code>

+ 25 - 13
template/scripts/BxBaseServiceAccount.php

@@ -49,9 +49,8 @@ class BxBaseServiceAccount extends BxDol
             header('Location: ' . BX_DOL_URL_ROOT);
             exit;
         }
-        
+
         if (isset($_SERVER['HTTP_REFERER']) && 0 === mb_stripos($_SERVER['HTTP_REFERER'], BX_DOL_URL_ROOT)) { // remember referrer
-            
             $sJoinReferrer = $_SERVER['HTTP_REFERER'];
             $aNoRelocatePages = array('forgot-password', 'login', 'create-account', 'logout');
             foreach ($aNoRelocatePages as $s) {
@@ -64,19 +63,32 @@ class BxBaseServiceAccount extends BxDol
                 BxDolSession::getInstance()->setValue('join-referrer', $sJoinReferrer);
         }
 
-	    $sLoginText = '';
-        if (!isset($aParams['no_login_text']) || false === (bool)$aParams['no_login_text'])
-            $sLoginText = '<hr class="bx-def-hr bx-def-margin-sec-topbottom" /><div>' . _t('_sys_txt_join_description', BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=login')) . '</div>';
-        
-        $sAuth = '';
-        if (!isset($aParams['no_auth_buttons']) || false === (bool)$aParams['no_auth_buttons'])
-            $sAuth = BxDolService::call('system', 'member_auth_code', array(), 'TemplServiceLogin');
+        $aTmplVarsAuth = [];
+        if(!isset($aParams['no_auth_buttons']) || false === (bool)$aParams['no_auth_buttons'])
+            $aTmplVarsAuth['content'] = BxDolService::call('system', 'member_auth_code', array(), 'TemplServiceLogin');
+
+        $aTmplVarsForm = [];
+        if(!(bool)getParam('sys_account_disable_join_form'))
+            $aTmplVarsForm['content'] = $this->_oAccountForms->createAccountForm($aParams);
 
-        $sFormCode = '';
-        if (!(bool)getParam('sys_account_disable_join_form'))
-            $sFormCode = $this->_oAccountForms->createAccountForm($aParams);
+        $aTmplVarsLogin = [];
+        if(!isset($aParams['no_login_text']) || false === (bool)$aParams['no_login_text'])
+            $aTmplVarsLogin['url'] = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=login');
         
-        return $sAuth . $sFormCode . $sLoginText;
+        return BxDolTemplate::getInstance()->parseHtmlByName('block_join.html', [
+            'bx_if:show_auth' => [
+                'condition' => !empty($aTmplVarsAuth),
+                'content' => $aTmplVarsAuth
+            ],
+            'bx_if:show_form' => [
+                'condition' => !empty($aTmplVarsForm),
+                'content' => $aTmplVarsForm,
+            ],
+            'bx_if:show_login' => [
+                'condition' => !empty($aTmplVarsLogin),
+                'content' => $aTmplVarsLogin
+            ],
+        ]);
     }
 
     public function serviceAccountSettingsEmail ($iAccountId = false)

+ 32 - 32
template/scripts/BxBaseServiceLogin.php

@@ -161,41 +161,41 @@ class BxBaseServiceLogin extends BxDol
             elseif ('homepage' == $sForceRelocate)
                 $oForm->aInputs['relocate']['value'] = BX_DOL_URL_ROOT;
         }
-        
-        $sFormCode = '';
-        if (!(bool)getParam('sys_account_disable_login_form'))
-            $sFormCode = $oForm->getCode();
 
-        BxDolTemplate::getInstance()->addJs(array('jquery.form.min.js'));
-        
-        $sJoinText = '';
-        if (strpos($sParams, 'no_join_text') === false)
-            $sJoinText = '<hr class="bx-def-hr bx-def-margin-sec-topbottom" /><div>' . _t('_sys_txt_login_description', BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=create-account')) . '</div>';
+        $aTmplVarsForm = [];
+        if(!(bool)getParam('sys_account_disable_login_form'))
+            $aTmplVarsForm['content'] = $oForm->getCode();
 
-        $sAuth = '';
-        if (strpos($sParams, 'no_auth_buttons') === false)
-            $sAuth = $this->serviceMemberAuthCode();
+        $aTmplVarsAuth = [];
+        if(strpos($sParams, 'no_auth_buttons') === false)
+            $aTmplVarsAuth['content'] = $this->serviceMemberAuthCode();
 
-        $sAjaxForm = '';
-        if (strpos($sParams, 'ajax_form') !== false)
-            $sAjaxForm = "<script>
-                (bx_login_init_ajax_form = function () {
-                    $('#sys-form-login').ajaxForm({
-                        dataType: 'json',
-                        success: function (oData) {
-                            if ('undefined' !== typeof(oData['res']) && 'OK' == oData['res']) {
-                                location.reload();
-                            }
-                            else if ('undefined' !== typeof(oData['form'])) {
-                                $('#sys-form-login').replaceWith(oData['form']);
-                                bx_login_init_ajax_form();
-                            }
-                        }
-                    });
-                })();
-            </script>";
-        
-        return $sCustomHtmlBefore . $sAuth . $sFormCode . $sCustomHtmlAfter . $sJoinText . $sAjaxForm;
+        $aTmplVarsJoin = [];
+        if(strpos($sParams, 'no_join_text') === false)
+            $aTmplVarsJoin['url'] = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=create-account');
+
+        $oTemplate = BxDolTemplate::getInstance();
+        $oTemplate->addJs(array('jquery.form.min.js'));        
+        return $oTemplate->parseHtmlByName('block_login.html', [
+            'custom_html_before' => $sCustomHtmlBefore,
+            'bx_if:show_auth' => [
+                'condition' => !empty($aTmplVarsAuth),
+                'content' => $aTmplVarsAuth
+            ],
+            'bx_if:show_form' => [
+                'condition' => !empty($aTmplVarsForm),
+                'content' => $aTmplVarsForm,
+            ],
+            'custom_html_after' => $sCustomHtmlAfter,
+            'bx_if:show_join' => [
+                'condition' => !empty($aTmplVarsJoin),
+                'content' => $aTmplVarsJoin
+            ],
+            'bx_if:show_js_code' => [
+                'condition' => strpos($sParams, 'ajax_form') !== false,
+                'content' => []
+            ]
+        ]);
 
     }
     

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác