Commit 76c164a5 by Bence Dányi

webui: better password selection

parent 4a235168
......@@ -241,16 +241,6 @@ $(function() {
$('#new-group-semester').change(updateSummary);
$('#new-group-members').change(updateSummary);
});
$('.hidden-password').click(function() {
if ($(this).attr('type') == 'password') {
$(this).attr('type', 'text');
$(this).addClass('shown');
this.select();
} else if (this.selectionStart - this.selectionEnd == 0) {
$(this).attr('type', 'password');
$(this).removeClass('shown');
}
});
$('.shares li').click(function(e) {
e.preventDefault();
e.stopPropagation();
......@@ -302,15 +292,6 @@ $(function() {
$(this).parent().next().find('.ipv4host').show();
}
});
$('#modal-container .hidden-password').click(function() {
if ($(this).attr('type') == 'password') {
$(this).attr('type', 'text');
$(this).addClass('shown');
} else {
$(this).attr('type', 'password');
$(this).removeClass('shown');
}
})
})
$('#modal').show();
};
......
......@@ -245,12 +245,12 @@ textarea {
.hidden-password {
padding-right: 25px;
background-image: url(/static/icons/eye-half.png);
background-image: url(/static/icons/eye.png);
background-repeat: no-repeat;
background-position: right center;
cursor: pointer;
&.shown {
background-image: url(/static/icons/eye.png);
background-image: url(/static/icons/eye-half.png);
}
}
......
......@@ -50,7 +50,22 @@
</tr>
<tr>
<th>{% trans "Password" %}:</th>
<td><input type="password" class="hidden-password" value="{{ i.pw }}" /></td>
<td><input id="vm-password" type="password" class="hidden-password" value="{{ i.pw }}" /></td>
</tr>
</table>
<script type="text/javascript">
$('#vm-password').click(function(e) {
if(e.offsetX > 130) {
if ($(this).attr('type') == 'password') {
$(this).attr('type', 'text');
$(this).addClass('shown');
this.select();
} else {
$(this).attr('type', 'password');
$(this).removeClass('shown');
this.selectionStart = this.selectionEnd = 0;
}
}
});
</script>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment