add set_admin_password utility

This commit is contained in:
Pratik Vyas 2013-10-04 13:54:21 +05:30
parent 3757916024
commit c95f18f2ad

13
wnf.py
View file

@ -123,6 +123,8 @@ def setup_utilities(parser):
help="Get or set domain in Website Settings")
parser.add_argument("--make_conf", nargs="*", metavar=("DB-NAME", "DB-PASSWORD"),
help="Create new conf.py file")
parser.add_argument("--set_admin_password", metavar='ADMIN-PASSWORD', nargs=1,
help="Set administrator password")
# clear
parser.add_argument("--clear_web", default=False, action="store_true",
@ -451,6 +453,15 @@ def commit(message):
def checkout(branch):
git(("checkout", branch))
@cmd
def set_admin_password(admin_password, site=None):
import webnotes
webnotes.connect(site=site)
webnotes.conn.sql("""update __Auth set `password`=password(%s)
where user='Administrator'""", (admin_password,))
webnotes.conn.commit()
webnotes.destroy()
def replace_code(start, txt1, txt2, extn, search=None, force=False):
"""replace all txt1 by txt2 in files with extension (extn)"""
import webnotes.utils
@ -498,4 +509,4 @@ def search_replace_with_prompt(fpath, txt1, txt2, force=False):
print colored('Updated', 'green')
if __name__=="__main__":
main()
main()