1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-10-20 10:20:42 +00:00
Files
seahub/seahub/templates/registration/password_set_form.html
2025-09-01 10:17:01 +08:00

74 lines
2.5 KiB
HTML

{% extends "base.html" %}
{% load i18n %}
{% block sub_title %}{% trans "Set Password" %} - {% endblock %}
{% block extra_style %}
<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}bootstrap/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}bootstrap/bootstrap.popover.min.css" />
{% endblock %}
{% block main_content %}
<div class="new-narrow-panel vh">
<h2 class="hd">{% trans "Set Password" %}</h2>
<form action="" method="post" class="con">{% csrf_token %}
{% if form.contact_email %}
<label for="id_contact_email">{% trans "Contact Email" %}</label>
{{ form.contact_email }}
{{ form.contact_email.errors }}
{% endif %}
<label for="id_new_password1">{% trans "Password" %}</label><br />
{{ form.new_password1 }}<br /> {{ form.new_password1.errors }}
<div id="pwd_strength"></div>
<label for="id_new_password2">{% trans "Confirm Password" %}</label><br />
{{ form.new_password2 }}<br /> {{ form.new_password2.errors }}
<p class="error hide"></p>
<input type="submit" value="{% trans "Submit" %}" class="submit" />
</form>
</div>
{% endblock %}
{% block extra_script %}
<script type="text/javascript" src="{{MEDIA_URL}}bootstrap/bootstrap.popover.min.js"></script>
<script type="text/javascript" src="{{MEDIA_URL}}bootstrap/bootstrap.min.js"></script>
<script type="text/javascript">
$('[type="email"], [type="password"]').addClass('input');
$('.new-narrow-panel').removeClass('vh');
{% if not request.is_mobile and not request.is_tablet %}
{% include "snippets/password_strength_js.html" %}
{% endif %}
$(function () {
if (typeof setupPasswordField !== 'undefined') {
setupPasswordField("id_password1", passwd_tip, template);
}
});
$('form').on('submit', function(){
var pwd1 = $('input[name="new_password1"]').val().trim(),
pwd2 = $('input[name="new_password2"]').val().trim();
if (!pwd1) {
$('.error').html("{% trans "Password cannot be blank" %}").removeClass('hide');
return false;
}
if (!pwd2) {
$('.error').html("{% trans "Please enter the password again" %}").removeClass('hide');
return false;
}
if (pwd1 != pwd2) {
$('.error').html("{% trans "Passwords don't match" %}").removeClass('hide');
return false;
}
if (!checkPasswordStrength(pwd1, {{strong_pwd_required}})) {
$('.error').html(passwd_tip).removeClass('hide');
return false;
}
});
</script>
{% endblock %}