Browse Source

Fix bugs and increase security entrance (#179)

* 修正用户文章详情显示错误

* 新增安全入口,修复部分错误文字显示

Co-Authored-By: garhing <[email protected]>
fxxsj 4 năm trước cách đây
mục cha
commit
b177272c02

+ 1 - 7
app/Http/Middleware/isSecurity.php

@@ -29,13 +29,7 @@ class isSecurity
             if ($code !== $websiteSecurityCode) {
                 Log::info(trans('error.unsafe_enter').$ip);
 
-                return Response::view(
-                    'auth.error',
-                    [
-                        'message' => trans('error.unsafe_enter').','.trans('error.visit').'<a href="'.route('login').'?securityCode=" target="_self">'.trans('error.safe_enter').'</a>',
-                    ],
-                    403
-                );
+                return Response::view('auth.safe');
             }
 
             Cache::put($cacheKey, $ip, 7200); // 2小时之内无需再次输入安全码访问

+ 1 - 0
resources/lang/en/error.php

@@ -13,6 +13,7 @@ return [
     'refresh_page' => 'Please Refresh Page, Then Try Again',
     'report'       => 'Error comes back with log: ',
     'safe_enter'   => 'Secure Entrance',
+    'safe_code'    => 'Please enter the security code',
     'system'       => 'System Error',
     'title'        => '⚠️Error Detected',
     'unauthorized' => 'Unauthorized Access',

+ 1 - 1
resources/lang/en/user.php

@@ -92,7 +92,7 @@ return [
         'total'           => 'Total: num invitation codes',
         'tips'            => 'Can generate <strong> :num <strong> invitation codes, valid within :days',
         'logs'            => 'Invitation Record',
-        'promotion'       => 'Register and activate with your invitation code, Both sides will get <mark>:traffic<mark> traffic as rewards; when invitees purchase services, you will get <mark>:referral percent%<mark> of their spend amount as commission.',
+        'promotion'       => 'Register and activate with your invitation code, Both sides will get <mark>:traffic</mark> traffic as rewards; when invitees purchase services, you will get <mark>:referral_percent%</mark> of their spend amount as commission.',
         'generate_failed' => 'Failed to generate',
     ],
     'reset_data'          => [

+ 1 - 0
resources/lang/zh_CN/error.php

@@ -13,6 +13,7 @@ return [
     'refresh_page' => '请刷新页面后,再访问',
     'report'       => '错❌误携带了报告:',
     'safe_enter'   => '安全入口访问',
+    'safe_code'    => '请输入安全码',
     'system'       => '系统错误',
     'title'        => '⚠️错误触发',
     'unauthorized' => '未授权访问',

+ 1 - 1
resources/views/auth/maintenance.blade.php

@@ -23,7 +23,7 @@
             const hours = Math.floor(distance % 86400000 / 3600000);
             const minutes = Math.floor(distance % 3600000 / 60000);
             const seconds = Math.floor(distance % 60000 / 1000);
-            document.getElementById('countdown').innerHTML = '<h2>' + days + ' <span> {{trans('validation.attributes.date')}} </span>: ' +
+            document.getElementById('countdown').innerHTML = '<h2>' + days + ' <span> {{trans('validation.attributes.day')}} </span>: ' +
                 hours + ' <span>{{trans('validation.attributes.hour')}}</span>: ' + minutes + ' <span>{{trans('validation.attributes.minute')}} </span>: ' +
                 seconds + '<span> {{trans('validation.attributes.second')}}</span> </h2>';
             if (distance <= 0) {

+ 16 - 0
resources/views/auth/safe.blade.php

@@ -0,0 +1,16 @@
+@extends('auth.layouts')
+@section('title', sysConfig('website_name').' - '.trans('error.safe_enter'))
+@section('content')
+<form role="form" action="/login?securityCode=">
+    <div class="form-group">
+        <div class="form-group form-material floating" data-plugin="formMaterial">
+            <input class="form-control" id="securityCode" name="securityCode"
+                placeholder="" type="text">
+            <label class="floating-label" for="securityCode">{{trans('error.safe_code')}}</label>
+        </div>
+    </div>
+    <div class="text-center">
+        <button type="submit" class="btn btn-lg btn-block mt-40 bg-indigo-500 text-white">{{trans('common.confirm')}}</button>
+    </div>
+</form>
+@endsection