Display U2F registration errors (fixes: #1148)

environments/ppa-mbqj77/deployments/1
Xavier Guimard 8 years ago
parent 86eb9aa7c7
commit 171097884e
  1. 17
      lemonldap-ng-portal/site/coffee/u2fregistration.coffee
  2. 25
      lemonldap-ng-portal/site/htdocs/static/common/js/u2fregistration.js
  3. 2
      lemonldap-ng-portal/site/htdocs/static/common/js/u2fregistration.min.js
  4. 1
      lemonldap-ng-portal/site/htdocs/static/languages/ar.json
  5. 1
      lemonldap-ng-portal/site/htdocs/static/languages/de.json
  6. 1
      lemonldap-ng-portal/site/htdocs/static/languages/en.json
  7. 1
      lemonldap-ng-portal/site/htdocs/static/languages/es.json
  8. 1
      lemonldap-ng-portal/site/htdocs/static/languages/fr.json
  9. 1
      lemonldap-ng-portal/site/htdocs/static/languages/it.json
  10. 1
      lemonldap-ng-portal/site/htdocs/static/languages/nl.json
  11. 1
      lemonldap-ng-portal/site/htdocs/static/languages/pt.json
  12. 1
      lemonldap-ng-portal/site/htdocs/static/languages/ro.json
  13. 1
      lemonldap-ng-portal/site/htdocs/static/languages/vi.json

@ -9,6 +9,14 @@ setMsg = (msg, level) ->
level = 'success' if level == 'positive'
$('#color').addClass "alert-#{level}"
displayError = (j, status, err) ->
console.log 'Error', err
res = JSON.parse j.responseText
if res and res.error
res = res.error.replace /.* /, ''
console.log 'Returned error', res
setMsg res, 'warning'
register = ->
# 1 get registration token
$.ajax
@ -16,8 +24,7 @@ register = ->
url: "#{portal}u2fregister/register"
data: {}
dataType: 'json'
error: (j, status, err) ->
console.log 'Error', err
error: displayError
success: (ch) ->
# 2 build response
request = [
@ -44,8 +51,7 @@ register = ->
setMsg 'u2fFailed', 'warning'
else if resp.result
setMsg 'u2fRegistered', 'positive'
error: (j, status, err) ->
console.log 'error', err
error: displayError
verify = ->
# 1 get challenge
@ -54,8 +60,7 @@ verify = ->
url: "#{portal}u2fregister/verify"
data: {}
dataType: 'json'
error: (j, status, err) ->
console.log 'Error', err
error: displayError
success: (ch) ->
# 2 build response
request = [

@ -5,7 +5,7 @@ LemonLDAP::NG U2F registration script
*/
(function() {
var register, setMsg, verify;
var displayError, register, setMsg, verify;
setMsg = function(msg, level) {
$('#msg').html(window.translate(msg));
@ -17,15 +17,24 @@ LemonLDAP::NG U2F registration script
return $('#color').addClass("alert-" + level);
};
displayError = function(j, status, err) {
var res;
console.log('Error', err);
res = JSON.parse(j.responseText);
if (res && res.error) {
res = res.error.replace(/.* /, '');
console.log('Returned error', res);
return setMsg(res, 'warning');
}
};
register = function() {
return $.ajax({
type: "POST",
url: portal + "u2fregister/register",
data: {},
dataType: 'json',
error: function(j, status, err) {
return console.log('Error', err);
},
error: displayError,
success: function(ch) {
var request;
request = [
@ -55,9 +64,7 @@ LemonLDAP::NG U2F registration script
return setMsg('u2fRegistered', 'positive');
}
},
error: function(j, status, err) {
return console.log('error', err);
}
error: displayError
});
}
});
@ -71,9 +78,7 @@ LemonLDAP::NG U2F registration script
url: portal + "u2fregister/verify",
data: {},
dataType: 'json',
error: function(j, status, err) {
return console.log('Error', err);
},
error: displayError,
success: function(ch) {
var request;
request = [

@ -1 +1 @@
(function(){var a,b,c;b=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(){return $.ajax({type:"POST",url:portal+"u2fregister/register",data:{},dataType:"json",error:function(e,d,f){return console.log("Error",f)},success:function(d){var e;e=[{challenge:d.challenge,version:d.version}];b("touchU2fDevice","positive");$("#u2fPermission").show();return u2f.register(d.appId,e,[],function(f){$("#u2fPermission").hide();if(f.errorCode){return b("unableToGetU2FKey","warning")}else{return $.ajax({type:"POST",url:portal+"u2fregister/registration",data:{registration:JSON.stringify(f)},dataType:"json",success:function(g){if(g.error){return b("u2fFailed","warning")}else{if(g.result){return b("u2fRegistered","positive")}}},error:function(h,g,i){return console.log("error",i)}})}})}})};c=function(){return $.ajax({type:"POST",url:portal+"u2fregister/verify",data:{},dataType:"json",error:function(e,d,f){return console.log("Error",f)},success:function(d){var e;e=[{keyHandle:d.keyHandle,version:d.version}];b("touchU2fDevice","positive");return u2f.sign(d.appId,d.challenge,e,function(f){if(f.errorCode){return b("unableToGetU2FKey","warning")}else{return $.ajax({type:"POST",url:portal+"u2fregister/signature",data:{signature:JSON.stringify(f)},dataType:"json",success:function(g){if(g.error){return b("u2fFailed","warning")}else{if(g.result){return b("u2fSuccess","positive")}}},error:function(h,g,i){return console.log("error",i)}})}})}})};$(document).ready(function(){$("#u2fPermission").hide();$("#register").on("click",a);$("#verify").on("click",c);return $("#goback").attr("href",portal)})}).call(this);
(function(){var a,b,c,d;c=function(e,f){$("#msg").html(window.translate(e));$("#color").removeClass("message-positive message-warning alert-success alert-warning");$("#color").addClass("message-"+f);if(f==="positive"){f="success"}return $("#color").addClass("alert-"+f)};a=function(f,e,h){var g;console.log("Error",h);g=JSON.parse(f.responseText);if(g&&g.error){g=g.error.replace(/.* /,"");console.log("Returned error",g);return c(g,"warning")}};b=function(){return $.ajax({type:"POST",url:portal+"u2fregister/register",data:{},dataType:"json",error:a,success:function(e){var f;f=[{challenge:e.challenge,version:e.version}];c("touchU2fDevice","positive");$("#u2fPermission").show();return u2f.register(e.appId,f,[],function(g){$("#u2fPermission").hide();if(g.errorCode){return c("unableToGetU2FKey","warning")}else{return $.ajax({type:"POST",url:portal+"u2fregister/registration",data:{registration:JSON.stringify(g)},dataType:"json",success:function(h){if(h.error){return c("u2fFailed","warning")}else{if(h.result){return c("u2fRegistered","positive")}}},error:a})}})}})};d=function(){return $.ajax({type:"POST",url:portal+"u2fregister/verify",data:{},dataType:"json",error:a,success:function(e){var f;f=[{keyHandle:e.keyHandle,version:e.version}];c("touchU2fDevice","positive");return u2f.sign(e.appId,e.challenge,f,function(g){if(g.errorCode){return c("unableToGetU2FKey","warning")}else{return $.ajax({type:"POST",url:portal+"u2fregister/signature",data:{signature:JSON.stringify(g)},dataType:"json",success:function(h){if(h.error){return c("u2fFailed","warning")}else{if(h.result){return c("u2fSuccess","positive")}}},error:function(i,h,k){return console.log("error",k)}})}})}})};$(document).ready(function(){$("#u2fPermission").hide();$("#register").on("click",b);$("#verify").on("click",d);return $("#goback").attr("href",portal)})}).call(this);

@ -146,6 +146,7 @@
"newPwdSentTo":"تم إرسال تأكيد إلى عنوان بريدك الإلكتروني.",
"noHistory":"هذا هو أول اتصال، مرحبا بك!",
"notFound": "لم يتم العثور: محاولة الدخول إلى صفحة غير متوفرة",
"noU2FKeyFound": "No U2F key found",
"oidcConsent":"التطبيق ٪s هل ترغب في معرفة:",
"openidAp":"هل توافق على تقديم الإعدادات التالية؟",
"openIdExample":"فمثلا:http://myopenid.org/toto",

@ -146,6 +146,7 @@
"newPwdSentTo":"A confirmation has been sent to your mail address.",
"noHistory":"This is your first connection, welcome!",
"notFound": "Not found: you try to access to an unavailable page",
"noU2FKeyFound": "No U2F key found",
"oidcConsent":"The application %s would like to know:",
"openidAp":"Do you agree to provide the following parameters?",
"openIdExample":"for example:http://myopenid.org/toto",

@ -146,6 +146,7 @@
"newPwdSentTo":"A confirmation has been sent to your mail address.",
"noHistory":"This is your first connection, welcome!",
"notFound": "Not found: you try to access to an unavailable page",
"noU2FKeyFound": "No U2F key found",
"oidcConsent":"The application %s would like to know:",
"openidAp":"Do you agree to provide the following parameters?",
"openIdExample":"for example:http://myopenid.org/toto",

@ -146,6 +146,7 @@
"newPwdSentTo":"A confirmation has been sent to your mail address.",
"noHistory":"This is your first connection, welcome!",
"notFound": "Not found: you try to access to an unavailable page",
"noU2FKeyFound": "No U2F key found",
"oidcConsent":"The application %s would like to know:",
"openidAp":"Do you agree to provide the following parameters?",
"openIdExample":"for example:http://myopenid.org/toto",

@ -146,6 +146,7 @@
"newPwdSentTo":"Une confirmation a été envoyée à votre adresse mail.",
"noHistory":"Ceci est votre première connexion, bienvenue !",
"notFound": "Non trouvé: vous tentez d'accéder à une page non disponible",
"noU2FKeyFound": "Aucune clef U2F trouvée",
"oidcConsent":"L'application %s voudrait connaître :",
"openidAp":"Consentez-vous à communiquer les paramètres suivants ?",
"openIdExample":"par exemple :http://myopenid.org/toto",

@ -146,6 +146,7 @@
"newPwdSentTo":"Una conferma è stata inviata all'indirizzo di posta elettronica.",
"noHistory":"Questa è la tua prima connessione, benvenuto!",
"notFound": "Non trovato: si tenta di accedere ad una pagina non disponibile",
"noU2FKeyFound": "No U2F key found",
"oidcConsent":"L'applicazione %s vorrebbe sapere:",
"openidAp":"Accetti di fornire i seguenti parametri?",
"openIdExample":"per esempio:http://myopenid.org/toto",

@ -146,6 +146,7 @@
"newPwdSentTo":"A confirmation has been sent to your mail address.",
"noHistory":"This is your first connection, welcome!",
"notFound": "Not found: you try to access to an unavailable page",
"noU2FKeyFound": "No U2F key found",
"oidcConsent":"The application %s would like to know:",
"openidAp":"Do you agree to provide the following parameters?",
"openIdExample":"for example:http://myopenid.org/toto",

@ -146,6 +146,7 @@
"newPwdSentTo":"A confirmation has been sent to your mail address.",
"noHistory":"This is your first connection, welcome!",
"notFound": "Not found: you try to access to an unavailable page",
"noU2FKeyFound": "No U2F key found",
"oidcConsent":"The application %s would like to know:",
"openidAp":"Do you agree to provide the following parameters?",
"openIdExample":"for example:http://myopenid.org/toto",

@ -146,6 +146,7 @@
"newPwdSentTo":"A confirmation has been sent to your mail address.",
"noHistory":"This is your first connection, welcome!",
"notFound": "Not found: you try to access to an unavailable page",
"noU2FKeyFound": "No U2F key found",
"oidcConsent":"The application %s would like to know:",
"openidAp":"Do you agree to provide the following parameters?",
"openIdExample":"for example:http://myopenid.org/toto",

@ -146,6 +146,7 @@
"newPwdSentTo":"Một xác nhận đã được gửi đến địa chỉ thư của bạn.",
"noHistory":"Đây là kết nối đầu tiên của bạn, chào mừng!",
"notFound": "Không tìm thấy: bạn cố gắng truy cập vào một trang không có sẵn",
"noU2FKeyFound": "No U2F key found",
"oidcConsent":"Ứng dụng % s muốn biết:",
"openidAp":"Bạn đồng ý cung cấp các thông số sau?",
"openIdExample":"ví dụ: http: //myopenid.org/toto",

Loading…
Cancel
Save