From a16d4b51c4452f3edf018310199be9dfbf07b89d Mon Sep 17 00:00:00 2001 From: cdhigh Date: Tue, 7 Sep 2021 07:38:57 -0300 Subject: [PATCH] 1.26.9 Add a field "Expiration" in page Edit account. --- apps/View/Admin.py | 18 ++++++++++++++++-- apps/__init__.py | 2 +- changelog.md | 3 +++ changelog_en.md | 3 +++ readme.md | 12 +++--------- readme_EN.md | 6 ++---- templates/adminmgrpwd.html | 10 ++++++++++ 7 files changed, 38 insertions(+), 16 deletions(-) diff --git a/apps/View/Admin.py b/apps/View/Admin.py index 887d3713..fcb41b55 100755 --- a/apps/View/Admin.py +++ b/apps/View/Admin.py @@ -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: @@ -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 = '    Click here to go back' % Admin.__url__ tips = _("Change password success!") + strBackPage diff --git a/apps/__init__.py b/apps/__init__.py index f6137076..84fdca49 100755 --- a/apps/__init__.py +++ b/apps/__init__.py @@ -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__ diff --git a/changelog.md b/changelog.md index 6fed672b..45b64c41 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # Changelog for KindleEar +## 1.26.9 + 1. 修改其他账号页面添加"有效期"选项。 + ## 1.26.8 1. "网友分享" 添加一个搜索栏。(小彩蛋:输入 "#download" 可以下载全部RSS资源) 2. 更新README和FAQ关于部署的说明。 diff --git a/changelog_en.md b/changelog_en.md index f1b71b4b..48b819b7 100644 --- a/changelog_en.md +++ b/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. diff --git a/readme.md b/readme.md index 4cf4cac0..ca611f60 100644 --- a/readme.md +++ b/readme.md @@ -70,15 +70,9 @@ config.py | DOMAIN | 你申请的应用的域名 | **不建议使用GAE Launcher部署KindleEar,除非你知道怎么设置Extra Flags等参数。** # 简化的部署步骤(推荐) - 假如你不想安装python和GAE SDK,则可以选择如下两种方法之一: - -1. 参考代码库 ,里面有详细的教程和服务器脚本,也很简单。 - -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: + 参考代码库 和教程 。 + 这种方法直接在GAE后台的console窗口就可以实现部署。 # 许可协议 KindleEar is licensed under the [AGPLv3](http://www.gnu.org/licenses/agpl-3.0.html) license. diff --git a/readme_EN.md b/readme_EN.md index 2dec5d1d..8991abd4 100644 --- a/readme_EN.md +++ b/readme_EN.md @@ -63,10 +63,8 @@ For example the author's site: # 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 and tutorial (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. diff --git a/templates/adminmgrpwd.html b/templates/adminmgrpwd.html index f6557975..8c4876bc 100644 --- a/templates/adminmgrpwd.html +++ b/templates/adminmgrpwd.html @@ -19,6 +19,16 @@ +
+ + +