forked from LMFDB/lmfdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser-manager.py
More file actions
29 lines (20 loc) · 731 Bytes
/
user-manager.py
File metadata and controls
29 lines (20 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import sys
def usage():
print(''' Usage: to change a password, type 'sage user-manager.py
changepassword username newpassword'. You must have a file
passwords.yaml in the current directory which holds the
authentication passwords. ''')
def changepassword(username, newpassword):
#import yaml
#pw_dict = yaml.load(open("passwords.yaml"))
#C['userdb'].authenticate(pw_dict['data']['username'],
# pw_dict['data']['password'])
from .users.pwdmanager import userdb
userdb.change_password(username, newpassword)
if len(sys.argv) != 4:
usage()
sys.exit(0)
if sys.argv[1] == 'changepassword':
changepassword(sys.argv[2], sys.argv[3])
else:
usage()