[fixes] complete signup and email footer frappe/erpnext#2433

This commit is contained in:
Rushabh Mehta 2014-11-27 12:33:40 +05:30
parent e1c4ec3e0c
commit a2fdef2c50
5 changed files with 8 additions and 14 deletions

View file

@ -457,6 +457,7 @@ class Database:
"""Return the temperory value and delete it."""
value = self.get_global(key, "__temp")
frappe.defaults.clear_default(key=key, parent="__temp")
return value
def set_global(self, key, val, user='__global'):
"""Save a global key value. Global values will be automatically set if they match fieldname."""

View file

@ -89,15 +89,7 @@ def evaluate_alert(doc, alert, event):
if not recipients:
return
template = alert.message + footer
# send alert
frappe.sendmail(recipients=recipients, subject=alert.subject,
message= frappe.render_template(template, {"doc": doc, "alert":alert}),
bulk=True, ref_doctype = doc.doctype, ref_docname = doc.name)
footer = """<div style='margin-top: 20px; font-size: 80%; color: #888'>
This Email Alert <em>{{alert.subject}}</em> was autogenerated for
{{ doc.doctype }} <a href="/desk#Form/{{doc.doctype}}/{{doc.name}}">{{doc.name}}</a>.
To update, modify it, go to Setup > Email > <a href="/desk#List/Email Alert">Email Alert</a>
"""

View file

@ -6365,4 +6365,3 @@ a:hover,
a:focus {
text-decoration: none;
}
/*# sourceMappingURL=bootstrap.css.map */

View file

@ -2,10 +2,11 @@
{% block content %}
<div class="login-content container" style="max-width: 800px;">
<form role="form" method="POST" action="/api/method/frappe.templates.pages.login.login_oauth_user">
<form role="form form-signin" method="POST"
action="/api/method/frappe.templates.pages.login.login_oauth_user">
<h2 class="form-signin-heading">{{ _("One Last Step") }}</h2>
<input type="hidden" name="key" value="{{ frappe.form_dict.key }}">
<input type="email" id="email_id"
<input type="email" id="email_id" name="email_id"
class="form-control" placeholder="{{ _('Email Id') }}" required autofocus>
<br>
<button class="btn btn-primary btn-complete-signup" type="submit">{{ _("Complete") }}</button>

View file

@ -159,15 +159,16 @@ def login_via_oauth2(provider, code, decoder=None):
login_oauth_user(info, provider=provider)
@frappe.whitelist()
@frappe.whitelist(allow_guest=True)
def login_oauth_user(data=None, provider=None, email_id=None, key=None):
if email_id and key:
data = frappe.db.get_temp(key)
data = json.loads(frappe.db.get_temp(key))
data["email"] = email_id
elif not "email" in data:
# ask for user email
key = frappe.db.set_temp(data)
key = frappe.db.set_temp(json.dumps(data))
frappe.db.commit()
frappe.local.response["type"] = "redirect"
frappe.local.response["location"] = "/complete_signup?key=" + key
return