diff --git a/webnotes/core/doctype/profile/profile.py b/webnotes/core/doctype/profile/profile.py index 4b1216aa53..3fac8626fc 100644 --- a/webnotes/core/doctype/profile/profile.py +++ b/webnotes/core/doctype/profile/profile.py @@ -43,7 +43,7 @@ class DocType: pass # email server not set, don't send email self.doc.new_password = "" - + self.update_gravatar() def check_enable_disable(self): # do not allow disabling administrator/guest @@ -106,6 +106,15 @@ class DocType: # owner is always name webnotes.conn.set(self.doc, 'owner', self.doc.name) webnotes.clear_cache(user=self.doc.name) + + def update_gravatar(self): + import md5 + if not self.doc.user_image: + if self.doc.fb_username: + self.doc.user_image = "https://graph.facebook.com/" + self.doc.fb_username + "/picture" + else: + self.doc.user_image = "https://secure.gravatar.com/avatar/" + md5.md5(self.doc.name).hexdigest() \ + + "?d=retro" def reset_password(self): from webnotes.utils import random_string, get_url diff --git a/webnotes/hooks.txt b/webnotes/hooks.txt index 02c550237b..1a57c2e015 100644 --- a/webnotes/hooks.txt +++ b/webnotes/hooks.txt @@ -31,6 +31,7 @@ scheduler_event = all:webnotes.utils.email_lib.bulk.flush scheduler_event = daily:webnotes.utils.email_lib.bulk.clear_outbox scheduler_event = daily:webnotes.core.doctype.notification_count.notification_count.delete_event_notification_count scheduler_event = daily:webnotes.core.doctype.event.event.send_event_digest +scheduler_event = hourly:webnotes.templates.generator.website_group.clear_event_cache on_session_creation = webnotes.auth.notify_administrator_login diff --git a/webnotes/templates/base.html b/webnotes/templates/base.html index 2014fa00e7..49a4ec9e40 100644 --- a/webnotes/templates/base.html +++ b/webnotes/templates/base.html @@ -60,7 +60,12 @@