Improvement in regex (#1431)

This commit is contained in:
Xavier Guimard 2018-06-20 06:56:32 +02:00
parent b823c888e2
commit 783349a39f
3 changed files with 8 additions and 8 deletions

View File

@ -60,8 +60,8 @@ setOrder = ->
# Function used to remove an OIDC consent
removeOidcConsent = (partner) ->
r = new RegExp partner, 'g'
datas['oidcConsents'] = datas['oidcConsents'].replace(r,'').replace(/,+/,',').replace(/^,/,'').replace(/,$/,'')
r = new RegExp "\b#{partner}\b,?"
datas['oidcConsents'] = datas['oidcConsents'].replace(r,'').replace(/,$/,'')
setKey '_oidcConnectedRP', datas['oidcConsents']
# Success
, () ->

View File

@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.9.3
// Generated by CoffeeScript 1.12.7
/*
LemonLDAP::NG Portal jQuery scripts
@ -59,8 +59,8 @@ LemonLDAP::NG Portal jQuery scripts
results.push(values[k] = tmp[k]);
}
return results;
} catch (_error) {
e = _error;
} catch (error1) {
e = error1;
console.log('Parsing error', e);
return console.log('JSON', $(this).text());
}
@ -76,8 +76,8 @@ LemonLDAP::NG Portal jQuery scripts
removeOidcConsent = function(partner) {
var r;
r = new RegExp(partner, 'g');
datas['oidcConsents'] = datas['oidcConsents'].replace(r, '').replace(/,+/, ',').replace(/^,/, '').replace(/,$/, '');
r = new RegExp("\b" + partner + "\b,?");
datas['oidcConsents'] = datas['oidcConsents'].replace(r, '').replace(/,$/, '');
return setKey('_oidcConnectedRP', datas['oidcConsents'], function() {
return $("[partner='" + partner + "']").hide();
}, function(j, s, e) {

File diff suppressed because one or more lines are too long