[fix] show clickable link in expiry message
This commit is contained in:
parent
427743e8a9
commit
5ebfe2e771
5 changed files with 31 additions and 34 deletions
|
|
@ -18,19 +18,21 @@ def check_if_expired():
|
|||
return
|
||||
|
||||
limits = get_limits()
|
||||
# if expired, stop user from logging in
|
||||
expires_on = formatdate(limits.get("expiry"))
|
||||
support_email = limits.get("support_email") or _("your provider")
|
||||
support_email = limits.get("support_email")
|
||||
|
||||
if limits.upgrade_link:
|
||||
upgrade_link = get_upgrade_link(limits.upgrade_link)
|
||||
frappe.throw(_("""Your subscription expired on {0}.
|
||||
To extend please upgrade from here: {1}""").format(expires_on, upgrade_link),
|
||||
SiteExpiredError)
|
||||
upgrade_link = '<a href="{upgrade_link}" target="_blank">{click_here}</a>'.format(upgrade_link=upgrade_link, click_here=_('click here'))
|
||||
message = _("""Your subscription expired on {0}. To extend your subscription, {1}.""").format(expires_on, upgrade_link)
|
||||
|
||||
elif support_email:
|
||||
message = _("""Your subscription expired on {0}. To extend your subscription, please send an email to {1}.""").format(expires_on, support_email)
|
||||
|
||||
else:
|
||||
frappe.throw(_("""Your subscription expired on {0}.
|
||||
To extend please send an email to {1}""").format(expires_on, support_email),
|
||||
SiteExpiredError)
|
||||
message = _("""Your subscription expired on {0}""").format(expires_on)
|
||||
|
||||
frappe.throw(message, SiteExpiredError)
|
||||
|
||||
def has_expired():
|
||||
if frappe.session.user=="Administrator":
|
||||
|
|
|
|||
|
|
@ -954,12 +954,6 @@ body {
|
|||
.content-header {
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
a:hover,
|
||||
a:visited,
|
||||
a:link,
|
||||
a:active {
|
||||
text-decoration: none;
|
||||
}
|
||||
.footer-group-label {
|
||||
display: inline-block;
|
||||
font-size: 11px;
|
||||
|
|
|
|||
|
|
@ -258,8 +258,8 @@ fieldset {
|
|||
// margin-top:30px;
|
||||
margin-bottom:30px;
|
||||
.title{
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -281,7 +281,7 @@ fieldset {
|
|||
|
||||
.no-results {
|
||||
text-align: center;
|
||||
|
||||
|
||||
.octicon-telescope {
|
||||
display: block;
|
||||
padding: 10px;
|
||||
|
|
@ -565,11 +565,6 @@ a.active {
|
|||
padding-bottom:20px;
|
||||
}
|
||||
|
||||
a:hover, a:visited, a:link, a:active
|
||||
{
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.footer-group-label {
|
||||
display:inline-block;
|
||||
font-size: 11px;
|
||||
|
|
@ -660,4 +655,4 @@ li .footer-child-item {
|
|||
font-weight: 500;
|
||||
margin-top: -10px;
|
||||
margin-right: -8px;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,16 +78,11 @@ login.signup = function() {
|
|||
|
||||
// Login
|
||||
login.call = function(args) {
|
||||
frappe.freeze();
|
||||
|
||||
$.ajax({
|
||||
return frappe.call({
|
||||
type: "POST",
|
||||
url: "/",
|
||||
data: args,
|
||||
dataType: "json",
|
||||
args: args,
|
||||
freeze: true,
|
||||
statusCode: login.login_handlers
|
||||
}).always(function(){
|
||||
frappe.unfreeze();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -97,8 +92,19 @@ login.login_handlers = (function() {
|
|||
if(xhr.responseJSON) {
|
||||
data = xhr.responseJSON;
|
||||
}
|
||||
var message = data._server_messages
|
||||
? JSON.parse(data._server_messages).join("\n") : default_message;
|
||||
|
||||
var message = default_message;
|
||||
if (data._server_messages) {
|
||||
message = ($.map(JSON.parse(data._server_messages || '[]'), function() {
|
||||
// temp fix for messages sent as dict
|
||||
try {
|
||||
return JSON.parse(v).message;
|
||||
} catch (e) {
|
||||
return v;
|
||||
}
|
||||
}) || []).join('<br>') || default_message;
|
||||
}
|
||||
|
||||
frappe.msgprint(message);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ $.extend(frappe, {
|
|||
data: opts.args,
|
||||
dataType: "json",
|
||||
headers: { "X-Frappe-CSRF-Token": frappe.csrf_token },
|
||||
statusCode: {
|
||||
statusCode: opts.statusCode || {
|
||||
404: function(xhr) {
|
||||
frappe.msgprint(__("Not found"));
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue