From 78f7ff36491fadf08eea6a45b98e282de34bef33 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 15 Jan 2014 12:24:10 +0530 Subject: [PATCH] profile fixes and ctrl+s issue in firefox --- webnotes/__init__.py | 1 + webnotes/core/doctype/profile/profile.py | 7 +++++-- webnotes/core/doctype/profile/profile.txt | 12 +++++------- webnotes/public/js/wn/app.js | 1 + webnotes/templates/pages/login.py | 6 ++++++ webnotes/utils/email_lib/smtp.py | 2 -- 6 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 webnotes/templates/pages/login.py diff --git a/webnotes/__init__.py b/webnotes/__init__.py index 039190918e..d2cb3b25f0 100644 --- a/webnotes/__init__.py +++ b/webnotes/__init__.py @@ -147,6 +147,7 @@ class DoesNotExistError(ValidationError): pass class MandatoryError(ValidationError): pass class InvalidSignatureError(ValidationError): pass class RateLimitExceededError(ValidationError): pass +class OutgoingEmailError(Exception): pass def get_traceback(): import utils diff --git a/webnotes/core/doctype/profile/profile.py b/webnotes/core/doctype/profile/profile.py index dd65292819..64e8f8a43b 100644 --- a/webnotes/core/doctype/profile/profile.py +++ b/webnotes/core/doctype/profile/profile.py @@ -37,8 +37,11 @@ class DocType: self.send_welcome_mail() webnotes.msgprint(_("Welcome Email Sent")) else: - self.email_new_password() - + try: + self.email_new_password() + except webnotes.OutgoingEmailError: + pass # email server not set, don't send email + self.doc.new_password = "" diff --git a/webnotes/core/doctype/profile/profile.txt b/webnotes/core/doctype/profile/profile.txt index 6d0329de89..da3f8597e8 100644 --- a/webnotes/core/doctype/profile/profile.txt +++ b/webnotes/core/doctype/profile/profile.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 11:54:44", "docstatus": 0, - "modified": "2013-12-20 19:24:17", + "modified": "2014-01-15 11:32:52", "modified_by": "Administrator", "owner": "Administrator" }, @@ -183,18 +183,16 @@ { "doctype": "DocField", "fieldname": "user_image", - "fieldtype": "Select", + "fieldtype": "Attach", "hidden": 0, - "label": "User Image", - "options": "attach_files:" + "label": "User Image" }, { "doctype": "DocField", "fieldname": "background_image", - "fieldtype": "Select", + "fieldtype": "Attach", "hidden": 0, - "label": "Background Image", - "options": "attach_files:" + "label": "Background Image" }, { "doctype": "DocField", diff --git a/webnotes/public/js/wn/app.js b/webnotes/public/js/wn/app.js index 0682bd057c..a2fcc94aa5 100644 --- a/webnotes/public/js/wn/app.js +++ b/webnotes/public/js/wn/app.js @@ -206,6 +206,7 @@ wn.Application = Class.extend({ return false; }) .keydown("meta+s ctrl+s", function(e) { + e.preventDefault(); if(cur_frm) { cur_frm.save_or_update(); } else if(wn.container.page.save_action) { diff --git a/webnotes/templates/pages/login.py b/webnotes/templates/pages/login.py new file mode 100644 index 0000000000..25f54d8658 --- /dev/null +++ b/webnotes/templates/pages/login.py @@ -0,0 +1,6 @@ +import webnotes + +def get_context(): + return { + "title": webnotes._("Login") + } \ No newline at end of file diff --git a/webnotes/utils/email_lib/smtp.py b/webnotes/utils/email_lib/smtp.py index d8da43cd6e..c302207142 100644 --- a/webnotes/utils/email_lib/smtp.py +++ b/webnotes/utils/email_lib/smtp.py @@ -13,8 +13,6 @@ from webnotes import msgprint from webnotes.utils import cint, expand_partial_links import email.utils -class OutgoingEmailError(webnotes.ValidationError): pass - def get_email(recipients, sender='', msg='', subject='[No Subject]', text_content = None, footer=None): """send an html email as multipart with attachments and all""" email = EMail(sender, recipients, subject)