diff --git a/frappe/limits.py b/frappe/limits.py index 83a586462a..650433b311 100755 --- a/frappe/limits.py +++ b/frappe/limits.py @@ -4,7 +4,7 @@ from frappe import _ from frappe.utils import now_datetime, getdate, flt, cint, get_fullname from frappe.installer import update_site_config from frappe.utils.data import formatdate -from frappe.utils.user import get_enabled_system_users +from frappe.utils.user import get_enabled_system_users, get_system_managers import os, subprocess, urlparse, urllib class SiteExpiredError(frappe.ValidationError): @@ -16,13 +16,23 @@ def check_if_expired(): """check if account is expired. If expired, do not allow login""" if not has_expired(): return - # if expired, stop user from logging in - expires_on = formatdate(get_limits().get("expiry")) - support_email = get_limits().get("support_email") or _("your provider") - frappe.throw(_("""Your subscription expired on {0}. - To extend please send an email to {1}""").format(expires_on, support_email), - SiteExpiredError) + limits = get_limits() + expires_on = formatdate(limits.get("expiry")) + support_email = limits.get("support_email") + + if limits.upgrade_link: + upgrade_link = get_upgrade_link(limits.upgrade_link) + upgrade_link = '{click_here}'.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: + message = _("""Your subscription expired on {0}""").format(expires_on) + + frappe.throw(message, SiteExpiredError) def has_expired(): if frappe.session.user=="Administrator": diff --git a/frappe/public/css/website.css b/frappe/public/css/website.css index 36b28e8b8f..9d19b7ce02 100644 --- a/frappe/public/css/website.css +++ b/frappe/public/css/website.css @@ -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; diff --git a/frappe/public/less/website.less b/frappe/public/less/website.less index ca18288d1e..1d6a5edd45 100644 --- a/frappe/public/less/website.less +++ b/frappe/public/less/website.less @@ -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; -} \ No newline at end of file +} diff --git a/frappe/templates/includes/login/login.js b/frappe/templates/includes/login/login.js index 40b65bff55..6e71661a4e 100644 --- a/frappe/templates/includes/login/login.js +++ b/frappe/templates/includes/login/login.js @@ -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('
') || default_message; + } + frappe.msgprint(message); }; } diff --git a/frappe/website/js/website.js b/frappe/website/js/website.js index 0c93f1d241..ab2a9c26ee 100644 --- a/frappe/website/js/website.js +++ b/frappe/website/js/website.js @@ -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")); },