Display epoch to LocaleStringDate (#1386)

This commit is contained in:
Christophe Maudoux 2018-04-04 22:23:59 +02:00
parent a3fdccf1fd
commit 4953923b06
4 changed files with 11 additions and 9 deletions

View File

@ -47,4 +47,6 @@ delete2F = (device, epoch) ->
$(document).ready ->
$('body').on 'click', '.btn-danger', () -> delete2F ( $(this).attr 'device' ), ( $(this).attr 'epoch' )
$('#goback').attr 'href', portal
$('#data-epoch').each => hide()
$(".data-epoch").each ->
myDate = new Date($(this).text() * 1000)
$(this).text(myDate.toLocaleString())

View File

@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.10.0
// Generated by CoffeeScript 1.9.3
/*
LemonLDAP::NG 2F registration script
@ -63,11 +63,11 @@ LemonLDAP::NG 2F registration script
return delete2F($(this).attr('device'), $(this).attr('epoch'));
});
$('#goback').attr('href', portal);
return $('#data-epoch').each((function(_this) {
return function() {
return hide();
};
})(this));
return $(".data-epoch").each(function() {
var myDate;
myDate = new Date($(this).text() * 1000);
return $(this).text(myDate.toLocaleString());
});
});
}).call(this);

View File

@ -1 +1 @@
(function(){var b,a,c;c=function(d,e){$("#msg").html(window.translate(d));$("#color").removeClass("message-positive message-warning alert-success alert-warning");$("#color").addClass("message-"+e);if(e==="positive"){e="success"}return $("#color").addClass("alert-"+e)};a=function(e,d,g){var f;console.log("Error",g);f=JSON.parse(e.responseText);if(f&&f.error){f=f.error.replace(/.* /,"");console.log("Returned error",f);return c(f,"warning")}};b=function(d,e){if(d==="U2F"){d="u"}else{if(d==="UBK"){d="yubikey"}else{if(d==="TOTP"){d="totp"}else{c("u2fFailed","warning")}}}$("#delete-"+e).hide();return $.ajax({type:"POST",url:portal+"2fregisters/"+d+"/delete",data:{epoch:e},dataType:"json",error:a,success:function(f){if(f.error){return c("notAuthorized","warning")}else{if(f.result){return c("yourKeyIsUnregistered","positive")}}},error:a})};$(document).ready(function(){$("body").on("click",".btn-danger",function(){return b($(this).attr("device"),$(this).attr("epoch"))});$("#goback").attr("href",portal);return $("#data-epoch").each((function(d){return function(){return hide()}})(this))})}).call(this);
(function(){var b,a,c;c=function(d,e){$("#msg").html(window.translate(d));$("#color").removeClass("message-positive message-warning alert-success alert-warning");$("#color").addClass("message-"+e);if(e==="positive"){e="success"}return $("#color").addClass("alert-"+e)};a=function(e,d,g){var f;console.log("Error",g);f=JSON.parse(e.responseText);if(f&&f.error){f=f.error.replace(/.* /,"");console.log("Returned error",f);return c(f,"warning")}};b=function(d,e){if(d==="U2F"){d="u"}else{if(d==="UBK"){d="yubikey"}else{if(d==="TOTP"){d="totp"}else{c("u2fFailed","warning")}}}$("#delete-"+e).hide();return $.ajax({type:"POST",url:portal+"2fregisters/"+d+"/delete",data:{epoch:e},dataType:"json",error:a,success:function(f){if(f.error){return c("notAuthorized","warning")}else{if(f.result){return c("yourKeyIsUnregistered","positive")}}},error:a})};$(document).ready(function(){$("body").on("click",".btn-danger",function(){return b($(this).attr("device"),$(this).attr("epoch"))});$("#goback").attr("href",portal);return $(".data-epoch").each(function(){var d;d=new Date($(this).text()*1000);return $(this).text(d.toLocaleString())})})}).call(this);

View File

@ -23,7 +23,7 @@
<tbody>
<TMPL_LOOP NAME="SFDEVICES">
<tr id='delete-<TMPL_VAR NAME="epoch">'>
<td class="align-middle" ><TMPL_VAR NAME="type"></td><td class="align-middle"><TMPL_VAR NAME="name"></td><td class="align-middle" id="data-epoch"><TMPL_VAR NAME="epoch"></td>
<td class="align-middle" ><TMPL_VAR NAME="type"></td><td class="align-middle"><TMPL_VAR NAME="name"></td><td class="data-epoch"><TMPL_VAR NAME="epoch"></td>
<td>
<span device='<TMPL_VAR NAME="type">' epoch='<TMPL_VAR NAME="epoch">' class="btn btn-danger" role="button">
<span class="glyphicon glyphicon-minus-sign"></span>&nbsp;