From 0116eaea56a337696aee96a4b3fbeb239a6f8df2 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 6 Aug 2012 19:55:27 +0530 Subject: [PATCH] fixes in install: store password in __Auth --- js/legacy/widgets/form/form.js | 2 +- py/webnotes/install_lib/install.py | 9 ++++----- py/webnotes/model/db_schema.py | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/js/legacy/widgets/form/form.js b/js/legacy/widgets/form/form.js index e9520482e4..72ebd47e0a 100644 --- a/js/legacy/widgets/form/form.js +++ b/js/legacy/widgets/form/form.js @@ -668,7 +668,7 @@ _f.Frm.prototype.refresh_fields = function() { f.df = wn.meta.get_docfield(this.doctype, fn, this.docname); if(f.df.fieldtype!='Section Break' && f.refresh) { - f.refresh(); + f.refresh(); } } diff --git a/py/webnotes/install_lib/install.py b/py/webnotes/install_lib/install.py index 6747c0e146..ff8c5cde26 100755 --- a/py/webnotes/install_lib/install.py +++ b/py/webnotes/install_lib/install.py @@ -107,8 +107,8 @@ class Installer: # set the basic passwords webnotes.conn.begin() - webnotes.conn.sql("""update tabProfile set password = password('admin') - where name='Administrator'""") + webnotes.conn.sql("""update __Auth set password = password('admin') + where user='Administrator'""") webnotes.conn.commit() def create_sessions_table(self): @@ -145,7 +145,7 @@ class Installer: def create_cache_item(self): import webnotes self.dbman.drop_table('__CacheItem') - webnotes.conn.sql("""create table __CacheItem( + webnotes.conn.sql("""create table __CacheItem ( `key` VARCHAR(180) NOT NULL PRIMARY KEY, `value` LONGTEXT, `expires_on` DATETIME @@ -153,8 +153,7 @@ class Installer: def create_auth_table(self): import webnotes - self.dbman.drop_table('__Auth') - webnotes.conn.sql("""create table __Auth( + webnotes.conn.sql("""create table if not exists __Auth ( `user` VARCHAR(180) NOT NULL PRIMARY KEY, `password` VARCHAR(180) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8""") \ No newline at end of file diff --git a/py/webnotes/model/db_schema.py b/py/webnotes/model/db_schema.py index 0bc39f3efc..4bada2fc52 100644 --- a/py/webnotes/model/db_schema.py +++ b/py/webnotes/model/db_schema.py @@ -346,7 +346,7 @@ class DbManager: def grant_all_privileges(self,target,user): try: - self.conn.sql("GRANT ALL PRIVILEGES ON `%s` . * TO '%s'@'localhost';" % (target, user)) + self.conn.sql("GRANT ALL PRIVILEGES ON `%s`.* TO '%s'@'localhost';" % (target, user)) except Exception,e: raise e