Bug525-Hui (#79)
Co-authored-by: Hui Lan <lanhui@zjnu.edu.cn> Reviewed-on: http://121.4.94.30:3000/mrlan/EnglishPal/pulls/79 Co-authored-by: mrlan <mrlan@noreply.121.4.94.30> Co-committed-by: mrlan <mrlan@noreply.121.4.94.30>Bug490-ChenQiuwei
parent
1373df2a3e
commit
03353d49b1
|
@ -1,6 +1,6 @@
|
||||||
import hashlib
|
import hashlib
|
||||||
import string
|
import string
|
||||||
from datetime import datetime
|
from datetime import datetime, timedelta
|
||||||
from UseSqlite import InsertQuery, RecordQuery
|
from UseSqlite import InsertQuery, RecordQuery
|
||||||
|
|
||||||
path_prefix = '/var/www/wordfreq/wordfreq/'
|
path_prefix = '/var/www/wordfreq/wordfreq/'
|
||||||
|
@ -23,7 +23,7 @@ def verify_user(username, password):
|
||||||
|
|
||||||
def add_user(username, password):
|
def add_user(username, password):
|
||||||
start_date = datetime.now().strftime('%Y%m%d')
|
start_date = datetime.now().strftime('%Y%m%d')
|
||||||
expiry_date = '20221230'
|
expiry_date = (datetime.now() + timedelta(days=30)).strftime('%Y%m%d') # will expire after 30 days
|
||||||
# 将用户名和密码一起加密,以免暴露不同用户的相同密码
|
# 将用户名和密码一起加密,以免暴露不同用户的相同密码
|
||||||
password = md5(username + password)
|
password = md5(username + password)
|
||||||
rq = InsertQuery(path_prefix + 'static/wordfreqapp.db')
|
rq = InsertQuery(path_prefix + 'static/wordfreqapp.db')
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<title>账号过期</title>
|
<title>账号过期</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p>您的账号{{ username }}过期。</p>
|
<p>您的账号过期(过期日 {{expiry_date}})。</p>
|
||||||
<p>为了提高服务质量,English Pal 收取会员费用, 每天1元。</p>
|
<p>为了提高服务质量,English Pal 收取会员费用, 每天1元。</p>
|
||||||
<p>请决定你要试用的时间长度,扫描下面支付宝二维码支付。 支付时请注明<i>English Pal Membership Fee</i>。 我们会于12小时内激活账号。</p>
|
<p>请决定你要试用的时间长度,扫描下面支付宝二维码支付。 支付时请注明<i>English Pal Membership Fee</i>。 我们会于12小时内激活账号。</p>
|
||||||
<p><img src="static/donate-the-author-hidden.jpg" width="120px" alt="支付宝二维码" /></p>
|
<p><img src="static/donate-the-author-hidden.jpg" width="120px" alt="支付宝二维码" /></p>
|
||||||
|
|
|
@ -107,7 +107,7 @@ def userpage(username):
|
||||||
# 用户过期
|
# 用户过期
|
||||||
user_expiry_date = session.get('expiry_date')
|
user_expiry_date = session.get('expiry_date')
|
||||||
if datetime.now().strftime('%Y%m%d') > user_expiry_date:
|
if datetime.now().strftime('%Y%m%d') > user_expiry_date:
|
||||||
return render_template('expiry.html')
|
return render_template('expiry.html', expiry_date=user_expiry_date)
|
||||||
|
|
||||||
# 获取session里的用户名
|
# 获取session里的用户名
|
||||||
username = session.get('username')
|
username = session.get('username')
|
||||||
|
|
Loading…
Reference in New Issue