Commit 6639fd6a authored by Leonidas Poulopoulos's avatar Leonidas Poulopoulos

Added mask to password field with sneak option. Fixed small bug with servers view page

parent cdea64f2
/*
* @name Twitter Bootstrap Show Password
* @descripton
* @version 0.6
* @requires Jquery 1.8.1
*
* @author Jeroen van Meerendonk
* @author-email jeroen@cyneek.com
* @author-website http://cyneek.com
*
* @author Joseba Juániz
* @author-email joseba@cyneek.com
* @author-website http://cyneek.com
* @licens MIT License - http://www.opensource.org/licenses/mit-license.php
*/
(function($){
$.fn.extend({
showPassword: function() {
var input_password = $(this);
console.log(input_password)
//create the icon and assign
var icon_password = $('<span tabindex="100" class="add-on"><i class="icon-eye-open"></i></span>').css('cursor', 'help').tooltip({trigger:'click'});
icon_password.attr('data-original-title', $(this).attr('value'));
input_password.on({
input : function() {
icon_password.attr('data-original-title', $(this).attr('value'));
}
});
// Create the wrap and append the icon
input_password.wrap('<div class="input-append" />').after(icon_password);
}
});
})(jQuery);
\ No newline at end of file
......@@ -10,7 +10,13 @@
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/static/js/showpass.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#id_passwp').showPassword();
});
</script>
{% endblock %}
......@@ -60,7 +66,7 @@
<div class="control-group {% if form.passwp.errors %} error {% endif %}">
<label class="control-label" for="id_passwp"><b>{% trans "Password" %}</b></label>
<div class="controls">
{{ form.passwp }}
<input type="password" maxlength="24" name="passwp" id="id_passwp" {% if edit %}value='{{form.instance.passwp}}'{% endif %} {% if form.data.passwp %}value='{{form.data.passwp}}'{% endif %}>
{% if form.passwp.errors %} <span class="help-inline"> {{ form.passwp.errors|join:", " }} </span>
{% endif %} <span class="help-block"> {{ form.passwp.help_text }}</span>
</div>
......
......@@ -77,12 +77,6 @@
{{ server.status_server }}
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_secret">{% trans "Secret" %}</label>
<div class="controls">
{{ server.secret }}
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_proto">{% trans "Protocol" %}</label>
<div class="controls">
......@@ -91,7 +85,7 @@
</div>
<div class="control-group">
<div class="controls">
<a class="btn btn-primary" href="{% url edit-servers service.pk %}">{% trans "Edit" %}</a>
<a class="btn btn-primary" href="{% url edit-servers server.pk %}">{% trans "Edit" %}</a>
</div>
</div>
</div>
......
......@@ -130,7 +130,7 @@ $("#delserverSubmit").click(function(){
<td>{{server.get_ertype_display}}</td>
<td>{{server.port}}</td>
<td>{{server.proto}}</td>
<td style="text-align: center;"><a href="{% url edit-servers server.pk %}" class="btn btn-small">{% trans "edit" %}</a> <a href="#" id="del_server_{{server.pk}}" data-servername="{{server.name}}" class="btn btn-small btn-warning">{% trans "delete" %}</a></td>
<td style="text-align: center;"><a href="{% url edit-servers server.pk %}" class="btn btn-small">{% trans "edit" %}</a> <a href="#" id="del_server_{{server.pk}}" data-servername="{{server.get_name}}" class="btn btn-small btn-warning">{% trans "delete" %}</a></td>
</tr>
{% endfor %}
</tbody>
......
......@@ -7,8 +7,14 @@
{% endblock %}
{% block extrahead %}
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/static/js/showpass.js"></script>
<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#id_secret').showPassword();
});
</script>
{% endblock %}
{% block homeactive %}{% endblock %}
{% block serversactive %}class="active"{% endblock %}
......@@ -93,7 +99,7 @@
<div class="control-group {% if form.secret.errors %} error {% endif %}">
<label class="control-label" for="id_secret"><b>{% trans "Secret" %}</b></label>
<div class="controls">
{{ form.secret }}
<input type="password" maxlength="16" name="secret" id="id_secret" {% if edit %}value='{{form.instance.secret}}'{% endif %} {% if form.data.secret %}value='{{form.data.secret}}'{% endif %}>
{% if form.secret.errors %} <span class="help-inline"> {{ form.secret.errors|join:", " }} </span>
{% endif %} <span class="help-block">{{ form.secret.help_text }}</span>
</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 to comment