Преглед изворни кода

Add option to 'logout' and forget auth

oz123 пре 10 година
родитељ
комит
5c85403104
2 измењених фајлова са 13 додато и 0 уклоњено
  1. 3 0
      pwman/ui/templates/main.tpl
  2. 10 0
      scripts/webui.py

+ 3 - 0
pwman/ui/templates/main.tpl

@@ -17,3 +17,6 @@
   </tr>
 %end
 </table>
+<form action="/forget" method="POST">
+<input type="submit" value="Forget password">
+</form>

+ 10 - 0
scripts/webui.py

@@ -85,6 +85,16 @@ def edit_node(no=None):
     return output
 
 
+@route('/forget', method=['GET', 'POST'])
+def forget():
+    global AUTHENTICATED
+    AUTHENTICATED = False
+    enc = CryptoEngine.get()
+    enc.forget()
+
+    redirect('/auth')
+
+
 @route('/auth', method=['GET', 'POST'])
 def is_authenticated():
     global AUTHENTICATED