diff --git a/cgi-bin/webnotes/model/db_schema.py b/cgi-bin/webnotes/model/db_schema.py index 0ab2de0b78..e1e02058d2 100644 --- a/cgi-bin/webnotes/model/db_schema.py +++ b/cgi-bin/webnotes/model/db_schema.py @@ -358,7 +358,7 @@ class DbManager: mysql = mysql_path and os.path.join(mysql_path, 'mysql') or 'mysql' try: - ret = os.system("%s -u root -p%s %s < %s"%(mysql, root_password.replace(" ", "\ "), target, source)) + ret = os.system("%s -u root -p%s %s < %s"%(mysql, root_password.replace(" ", "\ "), target.replace("$", "\$"), source)) except Exception,e: raise e diff --git a/cgi-bin/webnotes/profile.py b/cgi-bin/webnotes/profile.py index dd135ee1ba..bb9a201da2 100644 --- a/cgi-bin/webnotes/profile.py +++ b/cgi-bin/webnotes/profile.py @@ -150,10 +150,16 @@ class Profile: # get profile profile = webnotes.conn.sql("SELECT name, email, first_name, last_name FROM tabProfile WHERE name=%s OR email=%s",(self.name, self.name)) - + + profile_cols = [desc[0] for desc in webnotes.conn.sql("DESCRIBE tabProfile")] + if not profile: raise Exception, "Profile %s not found" % self.name - + elif 'registered' in profile_cols: + if not webnotes.conn.sql("SELECT registered FROM tabProfile WHERE name=%s", self.name)[0][0]: + # if an unregistered user tries to reset password + raise Exception, "You cannot reset your password as you have not completed registration. You need to complete registration using the link provided in the email." + # update tab Profile webnotes.conn.sql("UPDATE tabProfile SET password=password(%s) WHERE name=%s", (pwd, profile[0][0])) diff --git a/js/form.compressed.js b/js/form.compressed.js index 41980e4ee4..b46b5a7095 100644 --- a/js/form.compressed.js +++ b/js/form.compressed.js @@ -181,7 +181,7 @@ _f.Frm.prototype.savedoc=function(save_action,onsave,onerr){this.error_in_sectio _f.Frm.prototype.saveupdate=function(){this.save('Update');} _f.Frm.prototype.savesubmit=function(){var answer=confirm("Permanently Submit "+this.docname+"?");if(answer)this.save('Submit');} _f.Frm.prototype.savecancel=function(){var answer=confirm("Permanently Cancel "+this.docname+"?");if(answer)this.save('Cancel');} -_f.Frm.prototype.savetrash=function(){var me=this;var answer=confirm("Permanently Delete "+this.docname+"? This action cannot be reversed");if(answer){$c('webnotes.model.delete_doc',{dt:this.doctype,dn:this.docname},function(r,rt){if(r.message=='okay'){delete locals[me.doctype][me.docname];if(page_body.wntoolbar)page_body.wntoolbar.rdocs.remove(me.doctype,me.docname);nav_obj.show_last_open();}})}} +_f.Frm.prototype.savetrash=function(){var me=this;var answer=confirm("Permanently Delete "+this.docname+"? This action cannot be reversed");if(answer){$c('webnotes.model.delete_doc',{dt:this.doctype,dn:this.docname},function(r,rt){if(r.message=='okay'){LocalDB.delete_doc(me.doctype,me.docname);if(page_body.wntoolbar)page_body.wntoolbar.rdocs.remove(me.doctype,me.docname);nav_obj.show_last_open();}})}} _f.Frm.prototype.amend_doc=function(){if(!this.fields_dict['amended_from']){alert('"amended_from" field must be present to do an amendment.');return;} var me=this;var fn=function(newdoc){newdoc.amended_from=me.docname;if(me.fields_dict&&me.fields_dict['amendment_date']) newdoc.amendment_date=dateutil.obj_to_str(new Date());} @@ -495,4 +495,4 @@ wn.widgets.form.file_upload_done=function(doctype,docname,fileid,filename,at_id, fl.push(filename+','+fileid) doc.file_list=fl.join('\n');} else -doc.file_list=filename+','+fileid;doc.modified=new_timestamp;var frm=frms[doctype];frm.attachments.dialog.hide();msgprint('File Uploaded Sucessfully.');frm.refresh();} \ No newline at end of file +doc.file_list=filename+','+fileid;doc.modified=new_timestamp;var frm=frms[doctype];frm.attachments.dialog.hide();msgprint('File Uploaded Sucessfully.');frm.refresh();} diff --git a/js/widgets/form/form.js b/js/widgets/form/form.js index 207f45f841..0202f92e03 100644 --- a/js/widgets/form/form.js +++ b/js/widgets/form/form.js @@ -1118,7 +1118,7 @@ _f.Frm.prototype.savetrash = function() { $c('webnotes.model.delete_doc', {dt:this.doctype, dn:this.docname}, function(r,rt) { if(r.message=='okay') { // delete from locals - delete locals[me.doctype][me.docname]; + LocalDB.delete_doc(me.doctype, me.docname); // delete from recent if(page_body.wntoolbar) page_body.wntoolbar.rdocs.remove(me.doctype, me.docname);