1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

Added compat between new-future templates and existing ones

This commit is contained in:
Adolfo Gómez García 2018-08-22 05:52:54 +02:00
parent 121f5a6fa6
commit cb0150391a
2 changed files with 9 additions and 4 deletions

View File

@ -112,9 +112,13 @@ class IPAuth(Authenticator):
self.getGroups(ip, gm)
if gm.hasValidGroups() and self.dbAuthenticator().isValidUser(ip, True):
passw = ''
return '<script type="text/javascript">$("#id_user").val("' + ip + '");$("#id_password").val("' + passw + '");$("#loginform").submit();</script>'
return '''function setVal(element, value) {{
document.getElementById(element).value = value;
}}
setVal("id_user", "{ip}");
setVal("id_password", "{passwd}");
document.getElementById("loginform").submit();'''.format(ip=ip, passwd='')
else:
return '<div>Invalid auth (' + ip + ')</div><script type="text/javascript">$("#backToLogin").click()</script>'
return 'alert("invalid authhenticator"); window.location.reload();</script>'
# We will authenticate ip here, from request.ip
# If valid, it will simply submit form with ip submited and a cached generated random password

View File

@ -11,7 +11,8 @@
var vv = val;
$("#login").hide(300, function() {
$.get('{%url "uds.web.views.customAuth" idAuth=''%}' + vv, function(data) {
$('#nonStandardLogin').html(data);
eval(data);
// $('#nonStandardLogin').html(data);
$('#nonStandard').show(300);
});
});