Преглед изворни кода

OAuth 미설정 시 오류 메시지에 위키 스킨 씌움

hoparkgo9ma пре 7 година
родитељ
комит
739fc3c8bb
3 измењених фајлова са 10 додато и 4 уклоњено
  1. 6 4
      app.py
  2. 2 0
      language/en-US.json
  3. 2 0
      language/ko-KR.json

+ 6 - 4
app.py

@@ -2818,6 +2818,11 @@ def login_oauth(platform = None, func = None):
         api_url['profile'] = 'https://graph.facebook.com/me'
 
     if func == 'init':
+        if oauth_data['client_id'] == '' or oauth_data['client_secret'] == '':
+            return easy_minify(flask.render_template(skin_check(), imp = [load_lang('login'), wiki_set(), custom(), other2([0, 0])], data =  load_lang('oauth_disabled'), menu = [['user', load_lang('user')]]))
+        elif publish_url == 'https://':
+            return easy_minify(flask.render_template(skin_check(), imp = [load_lang('login'), wiki_set(), custom(), other2([0, 0])], data =  load_lang('oauth_settings_not_found'), menu = [['user', load_lang('user')]]))
+
         referrer_re = re.compile(r'(?P<host>^(https?):\/\/([^\/]+))\/(?P<refer>[^\/?]+)')
         if flask.request.referrer != None:
             referrer = referrer_re.search(flask.request.referrer)
@@ -2827,11 +2832,8 @@ def login_oauth(platform = None, func = None):
                 flask.session['referrer'] = referrer.group('refer')
         else:
             return redirect('/')
-        if oauth_data['client_id'] == '' or oauth_data['client_secret'] == '':
-            return '관리자가 이 기능을 비활성화시켰습니다.'
-        elif publish_url == 'https://':
-            return '관리자가 이 기능을 사용하는데 대한 정보를 제공하지 않았습니다.'
         flask.session['refer'] = flask.request.referrer
+        
         if platform == 'naver':
             return redirect(api_url['redirect']+'?response_type=code&client_id={}&redirect_uri={}&state={}'.format(data['client_id'], data['redirect_uri'], data['state']))
         elif platform == 'facebook':

+ 2 - 0
language/en-US.json

@@ -110,6 +110,8 @@
     "oauth_conn_new" : "Connect..",
     "oauth_signin_facebook" : "Sign in with facebook",
     "oauth_signin_naver" : "Sign in with NAVER",
+    "oauth_settings_not_found" : "Administrator has not provided any data about using this feature.",
+    "oauth_disabled" : "Administrator has disabled this feature.",
 
     "user_head_warring" : "user's head will deleted if you close the browser or when you are editting as guest",
     "http_warring" : "warning : if you are not on https connection, your information can be leaked. we won't response to that.",

+ 2 - 0
language/ko-KR.json

@@ -102,6 +102,8 @@
     "oauth_conn_new" : "연결하기",
     "oauth_signin_facebook" : "Facebook으로 로그인",
     "oauth_signin_naver" : "네이버 아이디로 로그인",
+    "oauth_settings_not_found" : "관리자가 이 기능을 사용하는데 대한 정보를 제공하지 않았습니다.",
+    "oauth_disabled" : "관리자가 이 기능을 비활성화시켰습니다.",
 
     "authority_error" : "권한이  부족합니다.",
     "no_login_error" : "비 로그인 상태 입니다.",