{% extends 'vulnerabilities/levels/base.html' %}
{% load static %}
{% load crispy_forms_tags %}

{% block level_title %}CyberVault's Forums{% endblock %}

{% block level_description %}
<div>
 <p>
  As a part of their effort to foster community and discusion, CyberVault has just launched a brand new forum system.
  You've been hearing a lot about it, and the CyberVault community is buzzing with excitement. Eager to dive into the
  bustling ecosystem of discussions, you log into your account, and start browsing the various threads.
 </p>
 <p>
  Intrigued by the chaotic yet captivating dance of words, you decide to leave your mark. The input field at the bottom of
  the page beckons, simple yet inviting. It's a place where anyone can whisper into the digital winds, hoping their words
  carry weight, maybe even more than intended.
 </p>
 <p>
  With the vibrant discussions above, your message could easily blend in or stand out; the choice seems trivial but is subtly
  profound. As you prepare to join the digital symposium, remember: in the realm of coded dialogues, the impact of words often
  transcends their immediate appearance. What you embed in your message might just echo back in unexpected ways.
 </p>
</div>
{% endblock %}

{% block hint_url %}
{% url 'vulnerabilities/level/hint' level_num=6 hint_num=1 %}
{% endblock %}

{% block level_content %}
<div class="container mt-5">
  <h1>CyberVault Forums</h1>
  <div class="row">
    <div class="col-lg-8">
      {# Some placeholder posts, hinting towards what's wrong #}
      <div class="p-3 border mb-3">
        <h5><i class="fa-solid fa-user"></i> User123</h5>
        <p>This new forum is amazing! I've been learning so much about CyberVault just by reading through these threads.</p>
        <small class="text-muted">Posted on: 2024-04-12</small>
      </div>
      <div class="p-3 border mb-3">
        <h5><i class="fa-solid fa-user"></i> ScriptMonkey88</h5>
        <p>Has anyone visited the new <b>art exhibition</b> downtown? The sculptures are <span style="color: red;">incredible</span>!</p>
        <small class="text-muted">Posted on: 2024-04-13</small>
      </div>
      <div class="p-3 border mb-3">
        <h5><i class="fa-solid fa-user"></i> Mr. HackerMan</h5>
        <p>Guys, I think this site might not be so secure...</p>
        <small class="text-muted">Posted on: 2024-04-14</small>
      </div>
      {# Show the posts created by the user #}
      {% for post in user_posts %}
      <div>
        <div class="p-3 border mb-3">
          <h5><i class="fa-solid fa-user"></i> You</h5>
          {# not actually safe, intentional XSS, will only contain posts made by the user themselves  #}
          <p>{{ post.content | safe }}</p>
          <small class="text-muted">Posted on: {{ post.created_at }}</small>
        </div>
      {% endfor %}
      {# Input form for new posts #}
      <div class="mt-4">
        <h5>Leave a Comment</h5>
        <form method="post" class="needs-validation" novalidate>
          {% csrf_token %}
          {{ form | crispy }}
          <div class="d-grid gap-2">
            <button type="submit" class="btn btn-primary">Submit</button>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>
{% endblock %}

{% comment %}
vi: ft=htmldjango
{% endcomment %}
