Skip to content

Commit

Permalink
1.26.9
Browse files Browse the repository at this point in the history
Add a field "Expiration" in page Edit account.
  • Loading branch information
cdhigh committed Sep 7, 2021
1 parent 769dc00 commit a16d4b5
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 16 deletions.
18 changes: 16 additions & 2 deletions apps/View/Admin.py
Expand Up @@ -86,12 +86,21 @@ class AdminMgrPwd(BaseHandler):
# 管理员修改其他账户的密码
def GET(self, name):
self.login_required('admin')
tips = _("Please input new password to confirm!")
return self.render('adminmgrpwd.html', "Change password", tips=tips, username=name)
u = KeUser.all().filter("name = ", name).get()
expiration = 0
if not u:
tips = _("The username '%s' not exist!") % name
else:
tips = _("Please input new password to confirm!")
expiration = u.expiration_days

return self.render('adminmgrpwd.html', "Change password", tips=tips, username=name, expiration=expiration)

def POST(self, _n=None):
self.login_required('admin')
name, p1, p2 = web.input().get('u'), web.input().get('p1'), web.input().get('p2')
expiration = str_to_int(web.input().get('ep', '0'))

if name:
u = KeUser.all().filter("name = ", name).get()
if not u:
Expand All @@ -106,6 +115,11 @@ def POST(self, _n=None):
tips = _("The password includes non-ascii chars!")
else:
u.passwd = pwd
u.expiration_days = expiration
if expiration:
u.expires = datetime.datetime.utcnow() + datetime.timedelta(days=expiration)
else:
u.expires = None
u.put()
strBackPage = '&nbsp;&nbsp;&nbsp;&nbsp;<a href="%s">Click here to go back</a>' % Admin.__url__
tips = _("Change password success!") + strBackPage
Expand Down
2 changes: 1 addition & 1 deletion apps/__init__.py
Expand Up @@ -11,7 +11,7 @@
import __builtin__, sys
from google.appengine.ext import vendor

__Version__ = '1.26.8'
__Version__ = '1.26.9'

__builtin__.__dict__['__Version__'] = __Version__

Expand Down
3 changes: 3 additions & 0 deletions changelog.md
@@ -1,5 +1,8 @@
# Changelog for KindleEar

## 1.26.9
1. 修改其他账号页面添加"有效期"选项。

## 1.26.8
1. "网友分享" 添加一个搜索栏。(小彩蛋:输入 "#download" 可以下载全部RSS资源)
2. 更新README和FAQ关于部署的说明。
Expand Down
3 changes: 3 additions & 0 deletions changelog_en.md
@@ -1,5 +1,8 @@
# Changelog for KindleEar

## 1.26.9
1. Add a field "Expiration" in page Edit account.

## 1.26.8
1. Add a search bar in shared library (trick: you can download all rss by input a keyword "#download" in search bar).
2. Update the description of the deployment process in readme and FAQ.
Expand Down
12 changes: 3 additions & 9 deletions readme.md
Expand Up @@ -70,15 +70,9 @@ config.py | DOMAIN | 你申请的应用的域名 |
**不建议使用GAE Launcher部署KindleEar,除非你知道怎么设置Extra Flags等参数。**

# 简化的部署步骤(推荐)
假如你不想安装python和GAE SDK,则可以选择如下两种方法之一:

1. 参考代码库 <https://github.com/bookfere/KindleEar-Uploader> ,里面有详细的教程和服务器脚本,也很简单。

2. 使用本机脚本:
2.1 [下载KindleEar](https://github.com/cdhigh/KindleEar/archive/master.zip) 并解压(改目录名为KindleEar)。
2.2 [下载KindleEar-Uploader](https://drive.google.com/folderview?id=0ByRickMo9V_XNlJITzhYM3JOYW8&usp=sharing) 并解压。
3.3 将KindleEar目录放到Uploader目录下,双击uploader.bat即开始上传,根据提示输入你的相关信息即可,在第一次成功部署之后,适用uploader再次升级KindleEar则不需要再次输入。
**此uploader仅适用于Windows系统。**
假如你不想安装python和GAE SDK:
参考代码库 <https://github.com/bookfere/KindleEar-Uploader> 和教程 <https://bookfere.com/post/19.html>
这种方法直接在GAE后台的console窗口就可以实现部署。

# 许可协议
KindleEar is licensed under the [AGPLv3](http://www.gnu.org/licenses/agpl-3.0.html) license.
Expand Down
6 changes: 2 additions & 4 deletions readme_EN.md
Expand Up @@ -63,10 +63,8 @@ For example the author's site: <http://kindleear.appspot.com>

# Deployment simplified
If you don't want to intall GAE SDK and python, you have another choice.

1. [Download KindleEar](https://github.com/cdhigh/KindleEar/archive/master.zip) and uncompress it (Change the name of folder to 'KindleEar').
2. [Download KindleEar-Uploader](https://drive.google.com/folderview?id=0ByRickMo9V_XNlJITzhYM3JOYW8&usp=sharing) and unzip it.
3. Put KindleEar folder into Uploader directory, double-click uploader.bat to start process of deployment.
Reference code repository <https://github.com/bookfere/KindleEar-Uploader> and tutorial <https://bookfere.com/post/19.html#ke_2_1> (in Chinese, but you can translate it by Google).
This method can be deployed directly in the console window of the GAE background.

# License
KindleEar is Licensed under the [AGPLv3](http://www.gnu.org/licenses/agpl-3.0.html) license.
Expand Down
10 changes: 10 additions & 0 deletions templates/adminmgrpwd.html
Expand Up @@ -19,6 +19,16 @@
<label for="p2">{{ _("Confirm password") }}</label>
<input id="p2" name="p2" type="password" placeholder="{{ _('Confirm password') }}" class="pure-u-1 pure-u-sm-1-2" />
</div>
<div class="pure-control-group">
<label for="ep">{{_("Expiration")}}</label>
<select class="pure-u-1 pure-u-sm-1-2 bool" name="ep">
<option value="0" {% if expiration == 0 %}selected="selected"{% endif %}>{{_("Never expire")}}</option>
<option value="30" {% if expiration == 30 %}selected="selected"{% endif %}>{{_("1 Month")}}</option>
<option value="90" {% if expiration == 90 %}selected="selected"{% endif %}>{{_("3 Months")}}</option>
<option value="180" {% if expiration == 180 %}selected="selected"{% endif %}>{{_("6 Months")}}</option>
<option value="365" {% if expiration == 365 %}selected="selected"{% endif %}>{{_("1 Year")}}</option>
</select>
</div>
<div class="pure-control-group" style="text-align:center;">
<button type="submit" class="pure-button pure-button-primary pure-input-rounded">{{ _("Confirm Change") }}</button>
</div>
Expand Down

0 comments on commit a16d4b5

Please sign in to comment.