Commit 1976e3e4 authored by Christophe Maudoux's avatar Christophe Maudoux 🐛
Browse files

Use standard HTML attribute + update unit tests (#2745)

parent f59d245f
Pipeline #21070 passed with stage
in 9 minutes and 47 seconds
......@@ -494,7 +494,8 @@ $(window).on 'load', () ->
field = ''
if datas['dontStorePassword']
$(".toggle-password").mousedown () ->
field = $(this).attr("name")
field = $(this).attr 'id'
field = field.replace /^toggle_/, ''
console.log 'Display', field
$(this).toggleClass("fa-eye fa-eye-slash")
$("input[name=#{field}]").attr('class', 'form-control')
......@@ -503,7 +504,8 @@ $(window).on 'load', () ->
$("input[name=#{field}]").attr('class', 'form-control key') if $("input[name=#{field}]").get(0).value
else
$(".toggle-password").mousedown () ->
field = $(this).attr("name")
field = $(this).attr 'id'
field = field.replace /^toggle_/, ''
console.log 'Display', field
$(this).toggleClass("fa-eye fa-eye-slash")
$("input[name=#{field}]").attr("type", "text")
......
......@@ -549,7 +549,9 @@ LemonLDAP::NG Portal jQuery scripts
field = '';
if (datas['dontStorePassword']) {
$(".toggle-password").mousedown(function() {
field = $(this).attr("name");
field = $(this).attr('id');
console.log('Display****', field);
field = field.replace(/^toggle_/, '');
console.log('Display', field);
$(this).toggleClass("fa-eye fa-eye-slash");
return $("input[name=" + field + "]").attr('class', 'form-control');
......@@ -562,7 +564,9 @@ LemonLDAP::NG Portal jQuery scripts
});
} else {
$(".toggle-password").mousedown(function() {
field = $(this).attr("name");
field = $(this).attr('id');
console.log('Display***', field);
field = field.replace(/^toggle_/, '');
console.log('Display', field);
$(this).toggleClass("fa-eye fa-eye-slash");
return $("input[name=" + field + "]").attr("type", "text");
......
......@@ -124,14 +124,14 @@
<input id="newpassword" name="newpassword" type="text" class="form-control" trplaceholder="newPassword" autocomplete="off" required aria-required="true"/>
<TMPL_IF NAME="ENABLE_PASSWORD_DISPLAY">
<div class="input-group-append">
<span class="input-group-text"><i name="newpassword" class="fa fa-eye-slash toggle-password"></i></span>
<span class="input-group-text"><i id="toggle_newpassword" class="fa fa-eye-slash toggle-password"></i></span>
</div>
</TMPL_IF>
<TMPL_ELSE>
<input id="newpassword" name="newpassword" type="password" class="form-control" trplaceholder="newPassword" required aria-required="true"/>
<TMPL_IF NAME="ENABLE_PASSWORD_DISPLAY">
<div class="input-group-append">
<span class="input-group-text"><i name="newpassword" class="fa fa-eye-slash toggle-password"></i></span>
<span class="input-group-text"><i id="toggle_newpassword" class="fa fa-eye-slash toggle-password"></i></span>
</div>
</TMPL_IF>
</TMPL_IF>
......@@ -145,14 +145,14 @@
<input id="confirmpassword" name="confirmpassword" type="text" class="form-control" trplaceholder="confirmPwd" autocomplete="off" required aria-required="true"/>
<TMPL_IF NAME="ENABLE_PASSWORD_DISPLAY">
<div class="input-group-append">
<span class="input-group-text"><i name="confirmpassword" class="fa fa-eye-slash toggle-password"></i></span>
<span class="input-group-text"><i id="toggle_confirmpassword" class="fa fa-eye-slash toggle-password"></i></span>
</div>
</TMPL_IF>
<TMPL_ELSE>
<input id="confirmpassword" name="confirmpassword" type="password" class="form-control" trplaceholder="confirmPwd" required aria-required="true"/>
<TMPL_IF NAME="ENABLE_PASSWORD_DISPLAY">
<div class="input-group-append">
<span class="input-group-text"><i name="confirmpassword" class="fa fa-eye-slash toggle-password"></i></span>
<span class="input-group-text"><i id="toggle_confirmpassword" class="fa fa-eye-slash toggle-password"></i></span>
</div>
</TMPL_IF>
</TMPL_IF>
......
......@@ -37,14 +37,14 @@
<input id="oldpassword" name="oldpassword" type="text" value="<TMPL_VAR NAME=OLDPASSWORD>" class="form-control" trplaceholder="currentPwd" autocomplete="off" required aria-required="true">
<TMPL_IF NAME="ENABLE_PASSWORD_DISPLAY">
<div class="input-group-append">
<span class="input-group-text"><i name="oldpassword" class="fa fa-eye-slash toggle-password"></i></span>
<span class="input-group-text"><i id="toggle_oldpassword" class="fa fa-eye-slash toggle-password"></i></span>
</div>
</TMPL_IF>
<TMPL_ELSE>
<input id="oldpassword" name="oldpassword" type="password" value="<TMPL_VAR NAME=OLDPASSWORD>" class="form-control" trplaceholder="currentPwd" required aria-required="true">
<TMPL_IF NAME="ENABLE_PASSWORD_DISPLAY">
<div class="input-group-append">
<span class="input-group-text"><i name="oldpassword" class="fa fa-eye-slash toggle-password"></i></span>
<span class="input-group-text"><i id="toggle_oldpassword" class="fa fa-eye-slash toggle-password"></i></span>
</div>
</TMPL_IF>
</TMPL_IF>
......@@ -62,14 +62,14 @@
<input id="newpassword" name="newpassword" type="text" class="form-control" trplaceholder="newPassword" autocomplete="off" required aria-required="true"/>
<TMPL_IF NAME="ENABLE_PASSWORD_DISPLAY">
<div class="input-group-append">
<span class="input-group-text"><i name="newpassword" class="fa fa-eye-slash toggle-password"></i></span>
<span class="input-group-text"><i id="toggle_newpassword" class="fa fa-eye-slash toggle-password"></i></span>
</div>
</TMPL_IF>
<TMPL_ELSE>
<input id="newpassword" name="newpassword" type="password" class="form-control" trplaceholder="newPassword" required aria-required="true"/>
<TMPL_IF NAME="ENABLE_PASSWORD_DISPLAY">
<div class="input-group-append">
<span class="input-group-text"><i name="newpassword" class="fa fa-eye-slash toggle-password"></i></span>
<span class="input-group-text"><i id="toggle_newpassword" class="fa fa-eye-slash toggle-password"></i></span>
</div>
</TMPL_IF>
</TMPL_IF>
......@@ -82,14 +82,14 @@
<input id="confirmpassword" name="confirmpassword" type="text" class="form-control" trplaceholder="confirmPwd" autocomplete="off" required aria-required="true"/>
<TMPL_IF NAME="ENABLE_PASSWORD_DISPLAY">
<div class="input-group-append">
<span class="input-group-text"><i name="confirmpassword" class="fa fa-eye-slash toggle-password"></i></span>
<span class="input-group-text"><i id="toggle_confirmpassword" class="fa fa-eye-slash toggle-password"></i></span>
</div>
</TMPL_IF>
<TMPL_ELSE>
<input id="confirmpassword" name="confirmpassword" type="password" class="form-control" trplaceholder="confirmPwd" required aria-required="true"/>
<TMPL_IF NAME="ENABLE_PASSWORD_DISPLAY">
<div class="input-group-append">
<span class="input-group-text"><i name="confirmpassword" class="fa fa-eye-slash toggle-password"></i></span>
<span class="input-group-text"><i id="toggle_confirmpassword" class="fa fa-eye-slash toggle-password"></i></span>
</div>
</TMPL_IF>
</TMPL_IF>
......
......@@ -20,14 +20,14 @@
<input id="passwordfield" name="password" type="text" class="form-control" trplaceholder="password" autocomplete="off" required aria-required="true" aria-hidden="true"/>
<TMPL_IF NAME="ENABLE_PASSWORD_DISPLAY">
<div class="input-group-append">
<span class="input-group-text"><i name="password" class="fa fa-eye-slash toggle-password"></i></span>
<span class="input-group-text"><i id="toggle_password" class="fa fa-eye-slash toggle-password"></i></span>
</div>
</TMPL_IF>
<TMPL_ELSE>
<input id="passwordfield" name="password" type="password" class="form-control" trplaceholder="password" required aria-required="true"/>
<TMPL_IF NAME="ENABLE_PASSWORD_DISPLAY">
<div class="input-group-append">
<span class="input-group-text"><i name="password" class="fa fa-eye-slash toggle-password"></i></span>
<span class="input-group-text"><i id="toggle_password" class="fa fa-eye-slash toggle-password"></i></span>
</div>
</TMPL_IF>
</TMPL_IF>
......
......@@ -18,7 +18,7 @@ my $client = LLNG::Manager::Test->new( {
ok( $res = $client->_get( '/', accept => 'text/html' ), 'Display portal' );
ok(
$res->[2]->[0] =~
m%<i name="password" class="fa fa-eye-slash toggle-password">%,
m%<i id="toggle_password" class="fa fa-eye-slash toggle-password">%,
' toggle password icon found'
) or print STDERR Dumper( $res->[2]->[0] );
count(2);
......@@ -45,17 +45,17 @@ ok(
);
ok(
$res->[2]->[0] =~
m%<i name="oldpassword" class="fa fa-eye-slash toggle-password">%,
m%<i id="toggle_oldpassword" class="fa fa-eye-slash toggle-password">%,
' toggle oldpassword icon found'
) or print STDERR Dumper( $res->[2]->[0] );
ok(
$res->[2]->[0] =~
m%<i name="newpassword" class="fa fa-eye-slash toggle-password">%,
m%<i id="toggle_newpassword" class="fa fa-eye-slash toggle-password">%,
' toggle newpassword icon found'
) or print STDERR Dumper( $res->[2]->[0] );
ok(
$res->[2]->[0] =~
m%<i name="confirmpassword" class="fa fa-eye-slash toggle-password">%,
m%<i id="toggle_confirmpassword" class="fa fa-eye-slash toggle-password">%,
' toggle confirmpassword icon found'
) or print STDERR Dumper( $res->[2]->[0] );
ok(
......
......@@ -102,12 +102,12 @@ SKIP: {
or print STDERR Dumper( $res->[2]->[0] );
ok(
$res->[2]->[0] =~
m%<i name="newpassword" class="fa fa-eye-slash toggle-password">%,
m%<i id="toggle_newpassword" class="fa fa-eye-slash toggle-password">%,
' toggle newpassword icon found'
) or print STDERR Dumper( $res->[2]->[0] );
ok(
$res->[2]->[0] =~
m%<i name="confirmpassword" class="fa fa-eye-slash toggle-password">%,
m%<i id="toggle_confirmpassword" class="fa fa-eye-slash toggle-password">%,
' toggle confirmpassword icon found'
) or print STDERR Dumper( $res->[2]->[0] );
ok(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment