diff options
| author | Bobby <[email protected]> | 2022-12-28 07:51:38 -0500 |
|---|---|---|
| committer | Bobby <[email protected]> | 2022-12-28 07:51:38 -0500 |
| commit | 54988a928d37fc12e1f6eb83c6ecfc2babe55e29 (patch) | |
| tree | 42f5a62061fc3b0a4e70484d6bfb4afe184224d1 /templates | |
| parent | 3ff3acef57e95ecd2e8dde429d4735e7c2e8e684 (diff) | |
| download | thatcomputerscientist-54988a928d37fc12e1f6eb83c6ecfc2babe55e29.tar.xz thatcomputerscientist-54988a928d37fc12e1f6eb83c6ecfc2babe55e29.zip | |
Registraion function with captcha working
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/blog/register.html | 99 |
1 files changed, 16 insertions, 83 deletions
diff --git a/templates/blog/register.html b/templates/blog/register.html index d94e545f..b168c153 100644 --- a/templates/blog/register.html +++ b/templates/blog/register.html @@ -1,86 +1,19 @@ {% extends 'blog/partials/base.html' %} {% block content %} -<div class="main"> - <section> - <h1>Register for an account</h1> - <p>Register for an account to post your thoughts and get feedback from other users.</p> - <form action="{% url 'users:register' %}" method="post" autocomplete="off"> - {% csrf_token %} - <div> - <label for="username">Username</label> - <input type="text" name="username" id="username" class="form-control" placeholder="Username" required> - {% for message in messages %} - {% if 'usernameError' in message.tags %} - <small class="error" style="display:block;">{{ message.message }}</small> - {% endif %} - {% endfor %} - </div> - <div> - <label for="email">Email</label> - <input type="email" name="email" id="email" class="form-control" placeholder="Email" required> - {% for message in messages %} - {% if 'emailError' in message.tags %} - <small class="error" style="display:block;">{{ message.message }}</small> - {% endif %} - {% endfor %} - </div> - <div> - <label for="password">Password</label> - <input type="password" name="password" id="password" class="form-control" placeholder="Password" required> - {% for message in messages %} - {% if 'passwordError' in message.tags %} - {% load replace %} - <small class="error" style="display:block;">{{ message.message|replace:"[']" }}</small> - {% endif %} - {% endfor %} - </div> - <div> - <label for="password2">Confirm Password</label> - <input type="password" name="password2" id="password2" class="form-control" placeholder="Confirm Password" required> - {% for message in messages %} - {% if 'password2Error' in message.tags %} - <small class="error" style="display:block;">{{ message.message }}</small> - {% endif %} - {% endfor %} - </div> - <div> - <label for="captcha" style="margin: 5px 0px; display: block;">Type Captcha</label> - <div id="captcha"> - {% load static %} - <img src="{{ captcha }}" alt="captcha" class="captcha" id="captcha_image" style="display: block;"> - <img src="{% static 'images/icons/button_refresh.jpeg' %}" alt="Refresh Captcha" id="refresh_captcha" data-refresh-captcha-url="{% url 'blog:refresh_captcha' %}"> - </div> - <input type="text" name="captcha" id="captcha" class="form-control" placeholder="Type Captcha" required> - {% for message in messages %} - {% if 'captchaError' in message.tags %} - <small class="error" style="display:block;">{{ message.message }}</small> - {% endif %} - {% endfor %} - </div> - <div> - <input type="submit" class="btn btn-primary" style="margin-top:10px" value="Register"> - </div> - <br> - {% for message in messages %} - {% if 'accountCreated' in message.tags %} - <small class="success" style="display:block;">{{ message.message }}</small> - {% endif %} - {% endfor %} - </section> -</div> -<script src={% static 'js/captcha.js' %}></script> -<script> - var username = new URLSearchParams(window.location.search).get('u'); - var email = new URLSearchParams(window.location.search).get('e'); - if (username) { - document.getElementsByName("username").forEach(function(input) { - input.value = username; - }); - } - if (email) { - document.getElementsByName("email").forEach(function(input) { - input.value = email.split('?u=')[0]; - }); - } -</script> +<h1>Register for an account</h1> +<p>Register for an account to post your thoughts and get feedback from other users.</p> +<hr> +<form method="post" id="register_form"> + <input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}" style="display: none;"> + {{ form.as_p }} + <img src="{% url 'ignis:captcha_image' captcha %}" alt="Captcha" id="captcha"> + <input type="hidden" name="expected_captcha" value="{{ captcha }}"> + <input type="submit" value="Register" class="button button-special"> +</form> +{% for message in messages %} + {% if 'accountCreated' in message.tags %} + <p><small class="success">{{ message.message }}</small></p> + {% endif %} +{% endfor %} {% endblock %} + |
