Merge branch 'dev' into 'master'

Add form after first login

See merge request crafty-controller/crafty-4!322
This commit is contained in:
Iain Powrie 2022-06-12 21:34:02 +00:00
commit 794e0c0699
4 changed files with 27 additions and 1 deletions

View File

@ -61,6 +61,7 @@ class Controller:
self.support_scheduler: BackgroundScheduler = BackgroundScheduler(
timezone=str(tz)
)
self.first_login = False
self.support_scheduler.start()
@staticmethod

View File

@ -398,6 +398,9 @@ class PanelHandler(BaseHandler):
template = "panel/contribute.html"
elif page == "dashboard":
page_data["first_log"] = self.controller.first_login
if self.controller.first_login and exec_user["username"] == "admin":
self.controller.first_login = False
if superuser: # TODO: Figure out a better solution
try:
page_data[

View File

@ -158,7 +158,8 @@ class PublicHandler(BaseHandler):
logger.info(
f"User: {user_data} Logged in from IP: {self.get_remote_ip()}"
)
if not user_data.last_ip and user_data.username == "admin":
self.controller.first_login = True
# record this login
user_data.last_ip = self.get_remote_ip()
user_data.last_login = Helpers.get_time_as_string()

View File

@ -23,7 +23,28 @@
</div>
<!-- Page Title Header Ends-->
{% if data['first_log'] %}
<script>
$(document).ready(function() {
bootbox.alert({
backdrop: true,
title: 'Your Feedback Is Appreciated...',
message: '<p>We will only request this information from the admin user once... 😊</p>'
+'<p><strong>All data collected is completely anonymous</strong> and is only used to improve Crafty 4.0 and allow us to more accurately report the number of Crafty 4 users.</p><iframe width="640px" height="480px"'
+'src="https://forms.office.com/Pages/ResponsePage.aspx?id=LwLajNkpXU2CKc95G1oO3MN0Hu3oEUNLr-EtLx31TS5UNUNVQlFNVUVYMEc'
+'1V1BKS0FQUUlERUtWQy4u&embed=true" frameborder="0" marginwidth="0" marginheight="0" style="border: none; max-width:100%;'
+' max-height:100vh" allowfullscreen webkitallowfullscreen mozallowfullscreen msallowfullscreen> </iframe>',
buttons: {
ok: {
label: 'Skip Survey/Done',
className: 'btn-secondary'
},
},
});
});
</script>
{% end %}
<div class="row">
<div class="col-md-12 grid-margin">
<div class="card">