forked from mrlan/EnglishPal
Compare commits
2 Commits
master
...
Bug525-Hui
Author | SHA1 | Date |
---|---|---|
Hui Lan | 773c1b34d4 | |
Hui Lan | fae0a032c5 |
|
@ -1,6 +1,6 @@
|
|||
import hashlib
|
||||
import string
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
from UseSqlite import InsertQuery, RecordQuery
|
||||
|
||||
path_prefix = '/var/www/wordfreq/wordfreq/'
|
||||
|
@ -23,7 +23,7 @@ def verify_user(username, password):
|
|||
|
||||
def add_user(username, password):
|
||||
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)
|
||||
rq = InsertQuery(path_prefix + 'static/wordfreqapp.db')
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<title>账号过期</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>您的账号{{ username }}过期。</p>
|
||||
<p>您的账号过期(过期日 {{expiry_date}})。</p>
|
||||
<p>为了提高服务质量,English Pal 收取会员费用, 每天1元。</p>
|
||||
<p>请决定你要试用的时间长度,扫描下面支付宝二维码支付。 支付时请注明<i>English Pal Membership Fee</i>。 我们会于12小时内激活账号。</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')
|
||||
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里的用户名
|
||||
username = session.get('username')
|
||||
|
|
Loading…
Reference in New Issue