ソースを参照

아 이렇게 해보자

Surplus_Up (2DU) 7 年 前
コミット
be0c007e73
3 ファイル変更7 行追加5 行削除
  1. 2 1
      route/change_password.py
  2. 2 2
      route/login.py
  3. 3 2
      route/register.py

+ 2 - 1
route/change_password.py

@@ -86,7 +86,8 @@ def change_password_2(conn, server_init):
             
             oauth_content += '</ul>'
 
-            if not re.search('^https:\/\/', flask.request.host_url):
+            forwarded_protocol = request.headers.get('X-Forwarded-Proto', None)
+            if forwarded_protocol == 'http':
                 http_warring = '<hr class=\"main_hr\"><span>' + load_lang('http_warring') + '</span>'
             else:
                 http_warring = ''

+ 2 - 2
route/login.py

@@ -77,8 +77,8 @@ def login_2(conn):
         if oauth_check == 0:
             oauth_content = ''
 
-        print(flask.request.host_url)
-        if not re.search('^https:\/\/', flask.request.host_url):
+        forwarded_protocol = request.headers.get('X-Forwarded-Proto', None)
+        if forwarded_protocol == 'http':
             http_warring = '<hr class=\"main_hr\"><span>' + load_lang('http_warring') + '</span>'
         else:
             http_warring = ''

+ 3 - 2
route/register.py

@@ -87,8 +87,9 @@ def register_2(conn):
         data = curs.fetchall()
         if data and data[0][0] != '':
             contract = data[0][0] + '<hr class=\"main_hr\">'
-
-        if not re.search('^https:\/\/', flask.request.host_url):
+        
+        forwarded_protocol = request.headers.get('X-Forwarded-Proto', None)
+        if forwarded_protocol == 'http':
             http_warring = '<hr class=\"main_hr\"><span>' + load_lang('http_warring') + '</span>'
         else:
             http_warring = ''