Merge pull request #17253 from surajshetty3416/fix-login-ux
perf(UX): Load splash screen immediately after login
This commit is contained in:
commit
f8fc1918d2
4 changed files with 10 additions and 6 deletions
|
|
@ -195,6 +195,7 @@ login.login_handlers = (function () {
|
|||
200: function (data) {
|
||||
if (data.message == 'Logged In') {
|
||||
login.set_status('{{ _("Success") }}', 'green');
|
||||
document.body.innerHTML = `{% include "templates/includes/splash_screen.html" %}`;
|
||||
window.location.href = frappe.utils.sanitise_redirect(frappe.utils.get_url_arg("redirect-to")) || data.home_page;
|
||||
} else if (data.message == 'Password Reset') {
|
||||
window.location.href = frappe.utils.sanitise_redirect(data.redirect_to);
|
||||
|
|
|
|||
4
frappe/templates/includes/splash_screen.html
Normal file
4
frappe/templates/includes/splash_screen.html
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<div class="centered splash">
|
||||
<img src="{{ splash_image or "/assets/frappe/images/frappe-framework-logo.png" }}"
|
||||
style="max-width: 100px; max-height: 100px;">
|
||||
</div>
|
||||
|
|
@ -26,10 +26,7 @@
|
|||
</head>
|
||||
<body>
|
||||
{% include "public/icons/timeless/icons.svg" %}
|
||||
<div class="centered splash">
|
||||
<img src="{{ splash_image or "/assets/frappe/images/frappe-framework-logo.png" }}"
|
||||
style="max-width: 100px; max-height: 100px;">
|
||||
</div>
|
||||
{% include "templates/includes/splash_screen.html" %}
|
||||
<div class="main-section">
|
||||
<header></header>
|
||||
<div id="body"></div>
|
||||
|
|
@ -45,7 +42,7 @@
|
|||
|
||||
if (!window.frappe) window.frappe = {};
|
||||
|
||||
frappe.boot = {{ boot }};
|
||||
frappe.boot = JSON.parse({{ boot }});
|
||||
frappe._messages = frappe.boot["__messages"];
|
||||
frappe.csrf_token = "{{ csrf_token }}";
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
# License: MIT. See LICENSE
|
||||
no_cache = 1
|
||||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
|
||||
|
|
@ -32,13 +33,14 @@ def get_context(context):
|
|||
|
||||
frappe.db.commit()
|
||||
|
||||
boot_json = frappe.as_json(boot)
|
||||
boot_json = frappe.as_json(boot, indent=None, separators=(",", ":"))
|
||||
|
||||
# remove script tags from boot
|
||||
boot_json = SCRIPT_TAG_PATTERN.sub("", boot_json)
|
||||
|
||||
# TODO: Find better fix
|
||||
boot_json = CLOSING_SCRIPT_TAG_PATTERN.sub("", boot_json)
|
||||
boot_json = json.dumps(boot_json)
|
||||
|
||||
context.update(
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue