func.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. # 모듈들 불러옴
  2. import css_html_js_minify
  3. import flask
  4. import json
  5. import sqlite3
  6. import hashlib
  7. import requests
  8. import re
  9. import html
  10. import os
  11. # 일부 툴 불러옴
  12. from set_mark.tool import *
  13. # 나무마크 불러옴
  14. from mark import *
  15. # 서브 언어팩 불러옴
  16. json_data = open(os.path.join('language', 'en-US.json'), 'rt', encoding='utf-8').read()
  17. else_lang = json.loads(json_data)
  18. def load_conn(data):
  19. global conn
  20. global curs
  21. conn = data
  22. curs = conn.cursor()
  23. load_conn2(data)
  24. def captcha_get():
  25. data = ''
  26. if custom()[2] == 0:
  27. curs.execute('select data from other where name = "recaptcha"')
  28. recaptcha = curs.fetchall()
  29. if recaptcha and recaptcha[0][0] != '':
  30. curs.execute('select data from other where name = "sec_re"')
  31. sec_re = curs.fetchall()
  32. if sec_re and sec_re[0][0] != '':
  33. data += recaptcha[0][0] + '<hr>'
  34. return data
  35. def update():
  36. # 호환성 설정
  37. try:
  38. curs.execute("alter table history add hide text default ''")
  39. curs.execute('select title, re from hidhi')
  40. for rep in curs.fetchall():
  41. curs.execute("update history set hide = 'O' where title = ? and id = ?", [rep[0], rep[1]])
  42. curs.execute("drop table if exists hidhi")
  43. print('move table hidhi')
  44. except:
  45. pass
  46. try:
  47. curs.execute("alter table user add date text default ''")
  48. print('user table add column date')
  49. except:
  50. pass
  51. try:
  52. curs.execute("alter table rb add band text default ''")
  53. print('rb table add column band')
  54. except:
  55. pass
  56. try:
  57. curs.execute("alter table ban add login text default ''")
  58. print('ban table add column login')
  59. except:
  60. pass
  61. try:
  62. curs.execute("select title, acl from data where acl != ''")
  63. for rep in curs.fetchall():
  64. curs.execute("insert into acl (title, dec, dis, why) values (?, ?, '', '')", [rep[0], rep[1]])
  65. curs.execute("alter table data drop acl")
  66. print('data table delete column acl')
  67. except:
  68. pass
  69. try:
  70. curs.execute("alter table user add email text default ''")
  71. print('user table add column email')
  72. except:
  73. pass
  74. try:
  75. curs.execute('select name, sub from filter where sub != "X" and sub != ""')
  76. filter_name = curs.fetchall()
  77. if filter_name:
  78. for filter_delete in filter_name:
  79. if filter_delete[1] != '' or filter_delete[1] != 'X':
  80. curs.execute("update filter set sub = '' where name = ?", [filter_delete[0]])
  81. print('filter data fix')
  82. except:
  83. pass
  84. try:
  85. curs.execute("alter table user add skin text default ''")
  86. print('user table add column skin')
  87. except:
  88. pass
  89. # 3.0.5 사용자 문서, 파일 문서, 분류 문서 영어화
  90. try:
  91. all_rep = [['사용자:', 'user:'], ['파일:', 'file:'], ['분류:', 'category:']]
  92. all_rep2 = ['data', 'history', 'acl', 'topic', 'back']
  93. for i in range(3):
  94. for j in range(6):
  95. if not j == 5:
  96. curs.execute('select title from ' + all_rep2[j] + ' where title like ?', [all_rep[i][0] + '%'])
  97. else:
  98. curs.execute('select link from back where link like ?', [all_rep[i][0] + '%'])
  99. user_rep = curs.fetchall()
  100. for user_rep2 in user_rep:
  101. first = re.sub('^' + all_rep[i][0], all_rep[i][1], user_rep2[0])
  102. if j == 0:
  103. curs.execute("update data set title = ? where title = ?", [first, user_rep2[0]])
  104. elif j == 1:
  105. curs.execute("update history set title = ? where title = ?", [first, user_rep2[0]])
  106. elif j == 2:
  107. curs.execute("update acl set title = ? where title = ?", [first, user_rep2[0]])
  108. elif j == 3:
  109. curs.execute("update topic set title = ? where title = ?", [first, user_rep2[0]])
  110. elif j == 4:
  111. curs.execute("update back set title = ? where title = ?", [first, user_rep2[0]])
  112. elif j == 5:
  113. curs.execute("update back set link = ? where link = ?", [first, user_rep2[0]])
  114. print('사용자 to user, 파일 to file, 분류 to category')
  115. except:
  116. pass
  117. conn.commit()
  118. def captcha_post(re_data, num = 1):
  119. if num == 1:
  120. if custom()[2] == 0 and captcha_get() != '':
  121. curs.execute('select data from other where name = "sec_re"')
  122. sec_re = curs.fetchall()
  123. if sec_re and sec_re[0][0] != '':
  124. data = requests.get('https://www.google.com/recaptcha/api/siteverify', params = { 'secret' : sec_re, 'response' : re_data })
  125. if not data:
  126. return 0
  127. else:
  128. json_data = data.json()
  129. if data.status_code == 200 and json_data['success'] == True:
  130. return 0
  131. else:
  132. return 1
  133. else:
  134. return 0
  135. else:
  136. return 0
  137. else:
  138. pass
  139. def load_lang(data):
  140. global lang
  141. try:
  142. if lang:
  143. pass
  144. except:
  145. curs.execute("select data from other where name = 'language'")
  146. rep_data = curs.fetchall()
  147. json_data = open(os.path.join('language', rep_data[0][0] + '.json'), 'rt', encoding='utf-8').read()
  148. lang = json.loads(json_data)
  149. if data == 'please_all':
  150. return lang
  151. else:
  152. if data in lang:
  153. return lang[data]
  154. else:
  155. return else_lang[data]
  156. def ip_or_user(data):
  157. if re.search('(\.|:)', data):
  158. return 1
  159. else:
  160. return 0
  161. def edit_help_button():
  162. # https://stackoverflow.com/questions/11076975/insert-text-into-textarea-at-cursor-position-javascript
  163. '''
  164. <script>
  165. function insertAtCursor(myField, myValue) {
  166. if (document.selection) {
  167. document.getElementById(myField).focus();
  168. sel = document.selection.createRange();
  169. sel.text = myValue;
  170. } else if (document.getElementById(myField).selectionStart || document.getElementById(myField).selectionStart == '0') {
  171. var startPos = document.getElementById(myField).selectionStart;
  172. var endPos = document.getElementById(myField).selectionEnd;
  173. document.getElementById(myField).value = document.getElementById(myField).value.substring(0, startPos) + myValue + document.getElementById(myField).value.substring(endPos, document.getElementById(myField).value.length);
  174. } else {
  175. document.getElementById(myField).value += myValue;
  176. }
  177. }
  178. </script>
  179. '''
  180. insert_list = [['[[]]', '링크'], ['[()]', '매크로'], ['{{{#!}}}', '중괄호']]
  181. '<a href="javascript:void(0);" onclick="insertAtCursor(\'content\', \'B\');">(A)</a>'
  182. return ['', '']
  183. def ip_warring():
  184. if custom()[2] == 0:
  185. curs.execute('select data from other where name = "no_login_warring"')
  186. data = curs.fetchall()
  187. if data and data[0][0] != '':
  188. text_data = '<span>' + data[0][0] + '</span><hr>'
  189. else:
  190. text_data = '<span>' + load_lang('no_login_warring') + '</span><hr>'
  191. else:
  192. text_data = ''
  193. return text_data
  194. def skin_check():
  195. skin = './views/acme/'
  196. try:
  197. curs.execute('select skin from user where id = ?', [ip_check()])
  198. skin_exist = curs.fetchall()
  199. if skin_exist and skin_exist[0][0] != '':
  200. if os.path.exists(os.path.abspath('./views/' + skin_exist[0][0] + '/index.html')) == 1:
  201. skin = './views/' + skin_exist[0][0] + '/'
  202. else:
  203. curs.execute('select data from other where name = "skin"')
  204. skin_exist = curs.fetchall()
  205. if skin_exist:
  206. if os.path.exists(os.path.abspath('./views/' + skin_exist[0][0] + '/index.html')) == 1:
  207. skin = './views/' + skin_exist[0][0] + '/'
  208. except:
  209. pass
  210. return skin + 'index.html'
  211. def next_fix(link, num, page, end = 50):
  212. list_data = ''
  213. if num == 1:
  214. if len(page) == end:
  215. list_data += '<hr><a href="' + link + str(num + 1) + '">(' + load_lang('next') + ')</a>'
  216. elif len(page) != end:
  217. list_data += '<hr><a href="' + link + str(num - 1) + '">(' + load_lang('previous') + ')</a>'
  218. else:
  219. list_data += '<hr><a href="' + link + str(num - 1) + '">(' + load_lang('previous') + ')</a> <a href="' + link + str(num + 1) + '">(' + load_lang('next') + ')</a>'
  220. return list_data
  221. def other2(data):
  222. return data + ['Deleted']
  223. def wiki_set(num = 1):
  224. if num == 1:
  225. data_list = []
  226. curs.execute('select data from other where name = ?', ['name'])
  227. db_data = curs.fetchall()
  228. if db_data and db_data[0][0] != '':
  229. data_list += [db_data[0][0]]
  230. else:
  231. data_list += ['Wiki']
  232. curs.execute('select data from other where name = "license"')
  233. db_data = curs.fetchall()
  234. if db_data and db_data[0][0] != '':
  235. data_list += [db_data[0][0]]
  236. else:
  237. data_list += ['CC 0']
  238. data_list += ['', '']
  239. curs.execute('select data from other where name = "logo"')
  240. db_data = curs.fetchall()
  241. if db_data and db_data[0][0] != '':
  242. data_list += [db_data[0][0]]
  243. else:
  244. data_list += [data_list[0]]
  245. curs.execute("select data from other where name = 'head'")
  246. db_data = curs.fetchall()
  247. if db_data and db_data[0][0] != '':
  248. data_list += [db_data[0][0]]
  249. else:
  250. data_list += ['']
  251. return data_list
  252. if num == 2:
  253. var_data = 'FrontPage'
  254. curs.execute('select data from other where name = "frontpage"')
  255. elif num == 3:
  256. var_data = '2'
  257. curs.execute('select data from other where name = "upload"')
  258. db_data = curs.fetchall()
  259. if db_data and db_data[0][0] != '':
  260. return db_data[0][0]
  261. else:
  262. return var_data
  263. def diff(seqm):
  264. output = []
  265. for opcode, a0, a1, b0, b1 in seqm.get_opcodes():
  266. if opcode == 'equal':
  267. output += [seqm.a[a0:a1]]
  268. elif opcode == 'insert':
  269. output += ["<span style='background:#CFC;'>" + seqm.b[b0:b1] + "</span>"]
  270. elif opcode == 'delete':
  271. output += ["<span style='background:#FDD;'>" + seqm.a[a0:a1] + "</span>"]
  272. elif opcode == 'replace':
  273. output += ["<span style='background:#FDD;'>" + seqm.a[a0:a1] + "</span>"]
  274. output += ["<span style='background:#CFC;'>" + seqm.b[b0:b1] + "</span>"]
  275. return ''.join(output)
  276. def admin_check(num, what):
  277. ip = ip_check()
  278. curs.execute("select acl from user where id = ?", [ip])
  279. user = curs.fetchall()
  280. if user:
  281. reset = 0
  282. while 1:
  283. if num == 1 and reset == 0:
  284. check = 'ban'
  285. elif num == 3 and reset == 0:
  286. check = 'toron'
  287. elif num == 4 and reset == 0:
  288. check = 'check'
  289. elif num == 5 and reset == 0:
  290. check = 'acl'
  291. elif num == 6 and reset == 0:
  292. check = 'hidel'
  293. elif num == 7 and reset == 0:
  294. check = 'give'
  295. else:
  296. check = 'owner'
  297. curs.execute('select name from alist where name = ? and acl = ?', [user[0][0], check])
  298. if curs.fetchall():
  299. if what:
  300. curs.execute("insert into re_admin (who, what, time) values (?, ?, ?)", [ip, what, get_time()])
  301. conn.commit()
  302. return 1
  303. else:
  304. if reset == 0:
  305. reset = 1
  306. else:
  307. break
  308. def ip_pas(raw_ip):
  309. hide = 0
  310. if re.search("(\.|:)", raw_ip):
  311. if not re.search("^" + load_lang('tool') + ":", raw_ip):
  312. curs.execute("select data from other where name = 'ip_view'")
  313. data = curs.fetchall()
  314. if data and data[0][0] != '':
  315. ip = '<span style="font-size: 75%;">' + hashlib.md5(bytes(raw_ip, 'utf-8')).hexdigest() + '</span>'
  316. if not admin_check('ban', None):
  317. hide = 1
  318. else:
  319. ip = raw_ip
  320. else:
  321. ip = raw_ip
  322. hide = 1
  323. else:
  324. curs.execute("select title from data where title = ?", ['user:' + raw_ip])
  325. if curs.fetchall():
  326. ip = '<a href="/w/' + url_pas('user:' + raw_ip) + '">' + raw_ip + '</a>'
  327. else:
  328. ip = '<a id="not_thing" href="/w/' + url_pas('user:' + raw_ip) + '">' + raw_ip + '</a>'
  329. if hide == 0:
  330. ip += ' <a href="/record/' + url_pas('user:' + raw_ip) + '">(' + load_lang('record') + ')</a>'
  331. return ip
  332. def custom():
  333. if 'MyMaiToNight' in flask.session:
  334. user_head = flask.session['MyMaiToNight']
  335. else:
  336. user_head = ''
  337. if 'Now' in flask.session and flask.session['Now'] == 1:
  338. curs.execute('select name from alarm where name = ? limit 1', [ip_check()])
  339. if curs.fetchall():
  340. user_icon = 2
  341. else:
  342. user_icon = 1
  343. else:
  344. user_icon = 0
  345. if user_icon != 0:
  346. curs.execute('select email from user where id = ?', [ip_check()])
  347. data = curs.fetchall()
  348. if data:
  349. email = data[0][0]
  350. else:
  351. email = ''
  352. else:
  353. email = ''
  354. if user_icon != 0:
  355. user_name = ip_check()
  356. else:
  357. user_name = load_lang('user')
  358. return ['', '', user_icon, user_head, email, user_name]
  359. def acl_check(name):
  360. ip = ip_check()
  361. if ban_check() == 1:
  362. return 1
  363. acl_c = re.search("^user:([^/]*)", name)
  364. if acl_c:
  365. acl_n = acl_c.groups()
  366. if admin_check(5, None) == 1:
  367. return 0
  368. curs.execute("select dec from acl where title = ?", ['user:' + acl_n[0]])
  369. acl_data = curs.fetchall()
  370. if acl_data:
  371. if acl_data[0][0] == 'all':
  372. return 0
  373. if acl_data[0][0] == 'user' and not re.search("(\.|:)", ip):
  374. return 0
  375. if ip != acl_n[0] or re.search("(\.|:)", ip):
  376. return 1
  377. if ip == acl_n[0] and not re.search("(\.|:)", ip) and not re.search("(\.|:)", acl_n[0]):
  378. return 0
  379. else:
  380. return 1
  381. file_c = re.search("^file:(.*)", name)
  382. if file_c and admin_check(5, 'edit (' + name + ')') != 1:
  383. return 1
  384. curs.execute("select acl from user where id = ?", [ip])
  385. user_data = curs.fetchall()
  386. curs.execute("select dec from acl where title = ?", [name])
  387. acl_data = curs.fetchall()
  388. if acl_data:
  389. if acl_data[0][0] == 'user':
  390. if not user_data:
  391. return 1
  392. if acl_data[0][0] == 'admin':
  393. if not user_data:
  394. return 1
  395. if not admin_check(5, 'edit (' + name + ')') == 1:
  396. return 1
  397. curs.execute('select data from other where name = "edit"')
  398. set_data = curs.fetchall()
  399. if set_data:
  400. if set_data[0][0] == 'user':
  401. if not user_data:
  402. return 1
  403. if set_data[0][0] == 'admin':
  404. if not user_data:
  405. return 1
  406. if not admin_check(5, None) == 1:
  407. return 1
  408. return 0
  409. def ban_check():
  410. ip = ip_check()
  411. band = re.search("^([0-9]{1,3}\.[0-9]{1,3})", ip)
  412. if band:
  413. band_it = band.groups()[0]
  414. else:
  415. band_it = 'Not'
  416. curs.execute("select block from ban where block = ?", [band_it])
  417. band_d = curs.fetchall()
  418. curs.execute("select block from ban where block = ?", [ip])
  419. ban_d = curs.fetchall()
  420. if band_d or ban_d:
  421. return 1
  422. return 0
  423. def topic_check(name, sub):
  424. ip = ip_check()
  425. if ban_check() == 1:
  426. return 1
  427. curs.execute("select acl from user where id = ?", [ip])
  428. user_data = curs.fetchall()
  429. curs.execute("select dis from acl where title = ?", [name])
  430. acl_data = curs.fetchall()
  431. if acl_data:
  432. if acl_data[0][0] == 'user':
  433. if not user_data:
  434. return 1
  435. if acl_data[0][0] == 'admin':
  436. if not user_data:
  437. return 1
  438. if not admin_check(3, 'topic (' + name + ')') == 1:
  439. return 1
  440. curs.execute("select title from stop where title = ? and sub = ?", [name, sub])
  441. if curs.fetchall():
  442. if not admin_check(3, 'topic (' + name + ')') == 1:
  443. return 1
  444. return 0
  445. def ban_insert(name, end, why, login, blocker):
  446. time = get_time()
  447. if re.search("^([0-9]{1,3}\.[0-9]{1,3})$", name):
  448. band = 'O'
  449. else:
  450. band = ''
  451. curs.execute("select block from ban where block = ?", [name])
  452. if curs.fetchall():
  453. curs.execute("insert into rb (block, end, today, blocker, why, band) values (?, ?, ?, ?, ?, ?)", [name, load_lang('release'), time, blocker, '', band])
  454. curs.execute("delete from ban where block = ?", [name])
  455. else:
  456. if login != '':
  457. login = 'O'
  458. else:
  459. login = ''
  460. if end != '':
  461. end += ' 00:00:00'
  462. curs.execute("insert into rb (block, end, today, blocker, why, band) values (?, ?, ?, ?, ?, ?)", [name, end, time, blocker, why, band])
  463. curs.execute("insert into ban (block, end, why, band, login) values (?, ?, ?, ?, ?)", [name, end, why, band, login])
  464. conn.commit()
  465. def rd_plus(title, sub, date):
  466. curs.execute("select title from rd where title = ? and sub = ?", [title, sub])
  467. if curs.fetchall():
  468. curs.execute("update rd set date = ? where title = ? and sub = ?", [date, title, sub])
  469. else:
  470. curs.execute("insert into rd (title, sub, date) values (?, ?, ?)", [title, sub, date])
  471. def history_plus(title, data, date, ip, send, leng):
  472. curs.execute("select id from history where title = ? order by id + 0 desc limit 1", [title])
  473. id_data = curs.fetchall()
  474. if id_data:
  475. curs.execute("insert into history (id, title, data, date, ip, send, leng) values (?, ?, ?, ?, ?, ?, ?)", [str(int(id_data[0][0]) + 1), title, data, date, ip, send, leng])
  476. else:
  477. curs.execute("insert into history (id, title, data, date, ip, send, leng) values ('1', ?, ?, ?, ?, ?, ?)", [title, data, date, ip, send + ' (' + load_lang('new') + ' ' + load_lang('document') + ')', leng])
  478. def leng_check(first, second):
  479. if first < second:
  480. all_plus = '+' + str(second - first)
  481. elif second < first:
  482. all_plus = '-' + str(first - second)
  483. else:
  484. all_plus = '0'
  485. return all_plus
  486. def redirect(data):
  487. return '<meta http-equiv="refresh" content="0; url=' + data + '">'
  488. def re_error(data):
  489. if data == '/ban':
  490. ip = ip_check()
  491. end = '<li>' + load_lang('why') + ' : ' + load_lang('authority_error') + '</li>'
  492. if ban_check() == 1:
  493. curs.execute("select end, why from ban where block = ?", [ip])
  494. end_data = curs.fetchall()
  495. if not end_data:
  496. match = re.search("^([0-9]{1,3}\.[0-9]{1,3})", ip)
  497. if match:
  498. curs.execute("select end, why from ban where block = ?", [match.groups()[0]])
  499. end_data = curs.fetchall()
  500. if end_data:
  501. end = '<li>' + load_lang('state') + ' : '
  502. if end_data[0][0]:
  503. now = int(re.sub('(\-| |:)', '', get_time()))
  504. day = int(re.sub('(\-| |:)', '', end_data[0][0]))
  505. if now >= day:
  506. curs.execute("delete from ban where block = ?", [ip])
  507. conn.commit()
  508. end += 'Re Try.'
  509. else:
  510. end += load_lang('why') + ' : ' + end_data[0][0]
  511. else:
  512. end += load_lang('why') + ' : ' + load_lang('limitless')
  513. end += '</li>'
  514. if end_data[0][1] != '':
  515. end += '<li>' + load_lang('why') + ' : ' + end_data[0][1] + '</li>'
  516. return css_html_js_minify.html_minify(flask.render_template(skin_check(),
  517. imp = ['Error', wiki_set(1), custom(), other2([0, 0])],
  518. data = '<h2>Error</h2><ul>' + end + '</ul>',
  519. menu = 0
  520. ))
  521. else:
  522. error_data = re.search('\/error\/([0-9]+)', data)
  523. if error_data:
  524. num = int(error_data.groups()[0])
  525. if num == 1:
  526. data = load_lang('no_login_error')
  527. elif num == 2:
  528. data = load_lang('no_exist_user_error')
  529. elif num == 3:
  530. data = load_lang('authority_error')
  531. elif num == 4:
  532. data = load_lang('no_admin_block_error')
  533. elif num == 6:
  534. data = load_lang('same_id_exist_error')
  535. elif num == 7:
  536. data = load_lang('long_id_error')
  537. elif num == 8:
  538. data = load_lang('id_char_error')
  539. elif num == 9:
  540. data = load_lang('file_exist_error')
  541. elif num == 10:
  542. data = load_lang('password_error')
  543. elif num == 13:
  544. data = load_lang('recaptcha_error')
  545. elif num == 14:
  546. data = load_lang('file_extension_error')
  547. elif num == 15:
  548. data = load_lang('edit_record_error')
  549. elif num == 16:
  550. data = load_lang('same_file_error')
  551. elif num == 17:
  552. data = load_lang('file_capacity_error') + ' ' + wiki_set(3)
  553. elif num == 19:
  554. data = load_lang('decument_exist_error')
  555. elif num == 20:
  556. data = load_lang('password_diffrent_error')
  557. elif num == 21:
  558. data = load_lang('edit_filter_error')
  559. elif num == 22:
  560. data = load_lang('file_name_error')
  561. else:
  562. data = '???'
  563. return css_html_js_minify.html_minify(flask.render_template(skin_check(),
  564. imp = ['Error', wiki_set(1), custom(), other2([0, 0])],
  565. data = '<h2>Error</h2><ul><li>' + data + '</li></ul>',
  566. menu = 0
  567. ))
  568. else:
  569. return redirect('/')