{% extends "base.html" %}

{% block title %}Change Password - {{ config.BBS_NAME }}{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-6">
        <div class="card">
            <div class="card-header">
                <i class="bi bi-key"></i> Change Password
            </div>
            <div class="card-body">
                <form method="POST" action="{{ url_for('profile.change_password') }}">
                    {{ form.hidden_tag() }}
                    
                    <div class="mb-3">
                        {{ form.current_password.label(class="form-label") }}
                        {{ form.current_password(class="form-control" + (" is-invalid" if form.current_password.errors else "")) }}
                        {% if form.current_password.errors %}
                            <div class="invalid-feedback">
                                {% for error in form.current_password.errors %}{{ error }}{% endfor %}
                            </div>
                        {% endif %}
                    </div>
                    
                    <div class="mb-3">
                        {{ form.new_password.label(class="form-label") }}
                        {{ form.new_password(class="form-control" + (" is-invalid" if form.new_password.errors else "")) }}
                        {% if form.new_password.errors %}
                            <div class="invalid-feedback">
                                {% for error in form.new_password.errors %}{{ error }}{% endfor %}
                            </div>
                        {% endif %}
                    </div>
                    
                    <div class="mb-3">
                        {{ form.confirm_password.label(class="form-label") }}
                        {{ form.confirm_password(class="form-control" + (" is-invalid" if form.confirm_password.errors else "")) }}
                        {% if form.confirm_password.errors %}
                            <div class="invalid-feedback">
                                {% for error in form.confirm_password.errors %}{{ error }}{% endfor %}
                            </div>
                        {% endif %}
                    </div>
                    
                    <div class="d-grid gap-2 d-md-flex justify-content-md-end">
                        <a href="{{ url_for('profile.view_user', username=current_user.username) }}" class="btn btn-secondary">Cancel</a>
                        {{ form.submit(class="btn btn-primary") }}
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}
