mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-11 18:56:23 +00:00
- Add Argon2PasswordHasher with high security settings as primary hasher - Implement fallback to PBKDF2PasswordHasher for CentOS 7/Python 3.6 compatibility - Add argon2-cffi dependency to requirements.txt - Replace all print statements with proper logging calls across codebase - Implement comprehensive logging configuration with multiple handlers: * ivatar.log - General application logs (INFO level) * ivatar_debug.log - Detailed debug logs (DEBUG level) * security.log - Security events (WARNING level) - Add configurable LOGS_DIR setting with local config override support - Create config_local.py.example with logging configuration examples - Fix code quality issues (flake8, black formatting, import conflicts) - Maintain backward compatibility with existing password hashes Security improvements: - New passwords use Argon2 (memory-hard, ASIC-resistant) - Enhanced PBKDF2 iterations for fallback scenarios - Structured logging for security monitoring and debugging - Production-ready configuration with flexible log locations Tests: 85/113 passing (failures due to external DNS/API dependencies) Code quality: All pre-commit hooks passing
76 lines
2.3 KiB
HTML
76 lines
2.3 KiB
HTML
{% extends 'base.html' %}
|
|
{% load i18n %}
|
|
{% load static %}
|
|
|
|
{% block title %}{% trans 'Crop photo' %}{% endblock title %}
|
|
|
|
{% block header %}<link rel="prefetch" href="{% static 'css/jcrop.css' %}">{% endblock header %}
|
|
|
|
{% block content %}
|
|
<style>
|
|
</style>
|
|
<h1>{% trans 'Crop photo' %}</h1>
|
|
|
|
<p>{% trans 'Draw a square around the portion of the image you want to use:' %}</p>
|
|
|
|
<form action="{% url 'crop_photo' photo.pk %}" method="post">{% csrf_token %}
|
|
{% if email %}<input type="hidden" name="email" value="{{email}}">{% endif %}
|
|
{% if openid %}<input type="hidden" name="openid" value="{{openid}}">{% endif %}
|
|
<div class="form-group">
|
|
<img src='{% url 'raw_image' photo.pk %}' id='cropbox'>
|
|
</div>
|
|
<input type='hidden' id='x' name='x' value='0'/>
|
|
<input type='hidden' id='y' name='y' value='0'/>
|
|
<input type='hidden' id='w' name='w' value='0'/>
|
|
<input type='hidden' id='h' name='h' value='0'/>
|
|
<div class="form-group">
|
|
<button type="submit" class="button" onsubmit="return checkCoords();">{% trans 'Crop' %}</button>
|
|
|
|
<a href="{% url 'profile' %}" class="button" title="{% trans 'May lead to wrong aspect ratio!' %}">{% trans 'Skip cropping' %}</a>
|
|
</div>
|
|
</form>
|
|
|
|
<script src="{% static '/js/jcrop.js' %}"></script>
|
|
<script type="text/javascript">
|
|
function updateCoords(c) {
|
|
$('#x').val(c.x);
|
|
$('#y').val(c.y);
|
|
$('#w').val(c.w);
|
|
$('#h').val(c.h);
|
|
};
|
|
|
|
function checkCoords() {
|
|
if (parseInt($('#w').val())) return true;
|
|
alert('Please select a crop region then press submit.');
|
|
return false;
|
|
};
|
|
</script>
|
|
<script type="text/javascript">
|
|
/// TODO: This needs to be reworked!
|
|
/// Should be some reasonable function of distance of the image to the
|
|
/// left and right screen border or so.
|
|
var windowwidth = $(window).width();
|
|
var usewidth = windowwidth - 60;
|
|
if(windowwidth < 400) {
|
|
usewidth = windowwidth - 60;
|
|
}
|
|
if(windowwidth > 800) {
|
|
usewidth = windowwidth - 100;
|
|
}
|
|
if(windowwidth > 1200) {
|
|
usewidth = windowwidth - 400;
|
|
}
|
|
|
|
jQuery(function($){
|
|
$('#cropbox').Jcrop({
|
|
onSelect: updateCoords,
|
|
bgOpacity: .2,
|
|
bgColor: 'transparent',
|
|
boxWidth: usewidth,
|
|
aspectRatio: 80 / 80,
|
|
});
|
|
});
|
|
</script>
|
|
<div style="height:40px"></div>
|
|
{% endblock content %}
|