Send extension setup message if user is logged in
This commit is contained in:
parent
c01db463f7
commit
e6acff13e5
|
@ -1,9 +1,10 @@
|
||||||
from app.onboarding.base import onboarding_bp
|
from app.onboarding.base import onboarding_bp
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
|
from flask_login import current_user
|
||||||
|
|
||||||
|
|
||||||
@onboarding_bp.route("/", methods=["GET"])
|
@onboarding_bp.route("/", methods=["GET"])
|
||||||
def index():
|
def index():
|
||||||
return render_template(
|
return render_template(
|
||||||
"onboarding/index.html",
|
"onboarding/index.html", is_user_logged_in=current_user is not None
|
||||||
)
|
)
|
||||||
|
|
|
@ -13,39 +13,28 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Text container -->
|
||||||
<div id="loading-section" class="mt-8 mb-4 text-center">
|
<div class="mt-8 mb-4 text-center">
|
||||||
<h3>Loading...</h3>
|
<h2 class="text-dark" style="font-size:2rem">Let's take back control of your inbox!</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="content-section" style="display: none">
|
<div class="mt-8 text-center">
|
||||||
<!-- Text container -->
|
{% if is_user_logged_in %}
|
||||||
<div class="mt-8 mb-4 text-center">
|
<h2 class="text-black-50" style="font-size:2rem">Performing the extension setup...</h2>
|
||||||
<h2 class="text-dark" style="font-size:2rem">Let's take back control of your inbox!</h2>
|
{% else %}
|
||||||
</div>
|
<a class="mx-6 p-4 text-decoration-none" style="background:black;color:white;" href="{{ url_for('auth.register', next=url_for('onboarding.setup_done')) }}">Create a new account</a>
|
||||||
|
<a class="mx-6 p-4 text-decoration-none" style="background:white;color:black;border-radius: 2px;border:1px solid black;" href="{{ url_for('auth.login', next=url_for('onboarding.setup_done')) }}">I already have an account</a>
|
||||||
<!-- Button container -->
|
{% endif %}
|
||||||
<div class="mt-8 text-center">
|
|
||||||
<a class="mx-6 p-4 text-decoration-none" style="background:black;color:white;" href="{{ url_for('auth.register', next=url_for('onboarding.setup_done')) }}">Create a new account</a>
|
|
||||||
<a class="mx-6 p-4 text-decoration-none" style="background:white;color:black;border-radius: 2px;border:1px solid black;" href="{{ url_for('auth.login', next=url_for('onboarding.setup_done')) }}">I already have an account</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
{% if is_user_logged_in %}
|
||||||
setTimeout(function() {
|
<script type="text/javascript">
|
||||||
const data = { tag: "PERFORM_EXTENSION_SETUP" };
|
setInterval(function() {
|
||||||
window.postMessage(data, "/");
|
const data = { tag: "PERFORM_EXTENSION_SETUP" };
|
||||||
}, 300); // Give some time to the extension for registering the listener
|
window.postMessage(data, "/");
|
||||||
|
}, 300); // Give some time to the extension for registering the listener
|
||||||
setTimeout(function() {
|
</script>
|
||||||
const loadingSection = document.getElementById("loading-section");
|
{% endif %}
|
||||||
const contentSection = document.getElementById("content-section");
|
|
||||||
|
|
||||||
loadingSection.style.display = "none";
|
|
||||||
contentSection.style.display = "block";
|
|
||||||
}, 1500); // If in this time the extension has not been able to perform the setup, show the buttons
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in a new issue