Prechádzať zdrojové kódy

获取后台验证码

locky 2 mesiacov pred
rodič
commit
8cafd1e568
2 zmenil súbory, kde vykonal 49 pridanie a 0 odobranie
  1. 6 0
      Controller/UserController.py
  2. 43 0
      Service/TemplateService.py

+ 6 - 0
Controller/UserController.py

@@ -3464,6 +3464,9 @@ class SingleLoginView(TemplateView):
         elif code_type == '2':
             redis_key = '{}_{}_GetDevicePassword'.format(email, uid)
             email_type = 'get_device_password'
+        elif code_type == '3':
+            redis_key = '{}_GetBackendVerificationCode'.format(email)
+            email_type = 'get_backend_verification_code'
         else:
             return response.json(444)
 
@@ -3519,6 +3522,9 @@ class SingleLoginView(TemplateView):
         elif code_type == '2':
             redis_key = '{}_{}_GetDevicePassword'.format(phone, uid)
             temp_msg = 'SMS_479855154' if country_code == '86' else 'SMS_479785146'
+        elif code_type == '3':
+            redis_key = '{}_GetBackendVerificationCode'.format(phone)
+            temp_msg = 'SMS_151675022' if country_code == '86' else 'SMS_172165867'
         else:
             return response.json(444)
 

+ 43 - 0
Service/TemplateService.py

@@ -170,6 +170,49 @@ class TemplateService:
         </div>
         </body>
         </html>
+        """
+                    }
+                }
+        elif type == 'get_backend_verification_code':
+                data = {
+                    'cn': {
+                        'title': '获取后台验证码',
+                        'body': """
+                            <!DOCTYPE html>
+        <html lang="en">
+        <head>
+            <meta charset="UTF-8">
+            <title>Title</title>
+        </head>
+        <body>
+        <div class="content"
+             style="overflow: hidden;padding:30px 10% 70px 10%;margin:0 10%;background-color: #fff;box-shadow:0 4px 20px rgba(0,0,0,0.1);word-break: break-all;">
+            <h2 style="margin: 30px 0;">您好,{username}</h2>
+            <p style="margin-bottom: 40px;">请输入验证码获取后台验证码,有效期5分钟:</p>
+            <span style="padding: 10px 20px; font-size: 24px;background-color: #EB6F5A;border-radius:4px;color:#fff;">{captcha}</span>
+        </div>
+        </body>
+        </html>
+                            """,
+                    },
+                    'en': {
+                        'title': 'Get Backend Verification Code',
+                        'body': """
+                            <!DOCTYPE html>
+        <html lang="en">
+        <head>
+            <meta charset="UTF-8">
+            <title>Title</title>
+        </head>
+        <body>
+        <div class="content"
+             style="overflow: hidden;padding:30px 10% 70px 10%;margin:0 10%;background-color: #fff;box-shadow:0 4px 20px rgba(0,0,0,0.1);word-break: break-all;">
+            <h2 style="margin: 30px 0;">Hello, {username}</h2>
+            <p style="margin-bottom: 40px;">Please input code to get backend verification code. only valid in 5 minutes!</p>
+            <span style="padding: 10px 20px; font-size: 24px;background-color: #EB6F5A;border-radius:4px;color:#fff;">{captcha}</span>
+        </div>
+        </body>
+        </html>
         """
                     }
                 }