Skip to content

Commit

Permalink
Increase point budget, auto-login logic PoC
Browse files Browse the repository at this point in the history
  • Loading branch information
pierotofy committed Sep 7, 2023
1 parent 4cd5a01 commit bd70b4b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/static/app/js/ModelView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ class ModelView extends React.Component {
window.viewer = new Potree.Viewer(container);
viewer.setEDLEnabled(true);
viewer.setFOV(60);
viewer.setPointBudget(1*1000*1000);
viewer.setPointBudget(10*1000*1000);
viewer.setEDLEnabled(true);
viewer.loadSettingsFromURL();

Expand Down
37 changes: 36 additions & 1 deletion app/templates/app/registration/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
{% endif %}

{% is_single_user_mode as autologin %}
{% external_auth_endpoint as ext_auth_ep %}

{% if autologin %}
<script>location.href='/';</script>
{% else %}
<form action="{% url 'login' %}" method="post" class="form-horizontal" role="form">{% csrf_token %}
<form id="loginForm" {% if ext_auth_ep != "" %} style="display: none" {% endif %} action="{% url 'login' %}" method="post" class="form-horizontal" role="form">{% csrf_token %}
{% for field in form %}
{% include 'registration/form_field.html' %}
{% endfor %}
Expand All @@ -34,5 +35,39 @@
</div>
</div>
</form>

{% if ext_auth_ep != '' %}
<div class="text-center" id="authLoading">
<i class="fa fa-spin fa-circle-notch fa-spin fa-fw fa-2x"></i>
</div>
<script>
function getCookie(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length === 2) return parts.pop().split(';').shift();
}
function delCookie(name) {
document.cookie = name +'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
}
$(function(){
if (getCookie("autologin") !== undefined){
$.ajax({
url: "{{ ext_auth_ep }}",
type: "POST",
}).done(function(res){
console.log(res);
// delCookie("autologin");
}).fail(function(){

// delCookie("autologin");
});
}else{
$("#authLoading").hide();
$("#loginForm").show();
}
});
</script>
{% endif %}

{% endif %}
{% endblock %}
4 changes: 4 additions & 0 deletions app/templatetags/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
register = template.Library()
logger = logging.getLogger('app.logger')

@register.simple_tag
def external_auth_endpoint():
return settings.EXTERNAL_AUTH_ENDPOINT

@register.filter
def disk_size(megabytes):
k = 1000
Expand Down

0 comments on commit bd70b4b

Please sign in to comment.