update login and registration links - csemanish12/flask_blog GitHub Wiki
We have login and registration page but the login and signup button in our navigation bar does not work. Lets add the login and signup link in our navigation bar. we will update our layout.html and replace "#" with actual link in login and registration tab.
<div class="navbar-nav">
<a class="nav-item nav-link" href="/login">Login</a>
<a class="nav-item nav-link" href="/registration">Register</a>
</div>we have our login page, but there is no link for sign up if the user has not registered to our website. lets add sign up link in our login page.
lets add these code in our login.html page
<div class="border-top pt-3">
<small class="text-muted">
Need an Account ? <a class="ml-2" href="/registration">Sign Up</a>
</small>
</div>Now, our login.html will look like
{% extends 'layout.html' %}
{% block content %}
<div class="content-section">
<form method="POST" action="">
{{ form.hidden_tag() }}
<fieldset class="form-group">
<legend class="border-bottom mb-4">Login</legend>
<div class="form-group">
{{ form.email.label(class="form-control-label") }}
{% if form.email.errors %}
{{ form.email(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.email.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.email(class="form-control form-control-lg") }}
{% endif %}
</div>
<div class="form-group">
{{ form.password.label(class="form-control-label") }}
{% if form.password.errors %}
{{ form.password(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.password.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.password(class="form-control form-control-lg") }}
{% endif %}
</div>
</fieldset>
<div class="form-group">
{{ form.submit(class="btn btn-outline-info") }}
</div>
</form>
</div>
<div class="border-top pt-3">
<small class="text-muted">
Need an Account ? <a class="ml-2" href="/registration">Sign Up</a>
</small>
</div>
{% endblock content %}lets do the similar thing for registration page. we will add sign in link in our registration page.
<div class="border-top pt-3">
<small class="text-muted">
Already Have an Account ? <a class="ml-2" href="/login">Sign In</a>
</small>
</div>Implementation can be found over this commit