Mercurial > wikked
comparison manage.py @ 13:30ae685b86df
Added support for authentatication
- Added `.wikirc` config file.
- Added login, logout.
- Added users and groups.
- CLI command to generate user.
- CLI command to reset the index.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 30 Dec 2012 19:57:52 -0800 |
parents | c946f4facfa2 |
children | 420ff74c2e28 |
comparison
equal
deleted
inserted
replaced
12:ff0058feccf5 | 13:30ae685b86df |
---|---|
1 import os.path | 1 import os.path |
2 from flask.ext.script import Manager, Command | 2 import logging |
3 from wikked import app | 3 from flask.ext.script import Manager, Command, prompt, prompt_pass |
4 from wikked import app, wiki | |
5 | |
4 | 6 |
5 manager = Manager(app) | 7 manager = Manager(app) |
6 | 8 |
9 | |
7 @manager.command | 10 @manager.command |
8 def stats(): | 11 def users(): |
9 """Prints some stats about the wiki.""" | 12 """Lists users of this wiki.""" |
10 pass | 13 print "Users:" |
14 for user in wiki.auth.getUsers(): | |
15 print " - " + user.username | |
16 print "" | |
17 | |
18 @manager.command | |
19 def new_user(): | |
20 """Generates the entry for a new user so you can | |
21 copy/paste it in your `.wikirc`. | |
22 """ | |
23 username = prompt('Username: ') | |
24 password = prompt_pass('Password: ') | |
25 password = app.bcrypt.generate_password_hash(password) | |
26 print "[users]" | |
27 print "%s = %s" % (username, password) | |
28 | |
29 | |
30 @manager.command | |
31 def reset_index(): | |
32 """ Re-generates the index, if search is broken | |
33 somehow in your wiki. | |
34 """ | |
35 wiki.index.reset(wiki.getPages()) | |
11 | 36 |
12 | 37 |
13 if __name__ == "__main__": | 38 if __name__ == "__main__": |
14 manager.run() | 39 manager.run() |
15 | 40 |