Header Ads

Python Django with Google Firebase - Firebase Authentication : SignUp form Using Pyrebase #Part3

In this part of Python Django with Google Firebase tutorial we'll extend Firebase Authentication and explore how we can create user SignUp Form and maintain each user data in database with additional functionality of Invalid  SignUp alert (existing user, invalid email/ password format).




Check out this video, code below follows the video to help
If you like videos like this consider donating $1, or simply turn off AdBlocker. Either helps me to continue making tutorials.


Transcript / Cheat Sheet :


Templates:
First we need to edit our 'SignIn.html' template in which we will add a button for SignUp which will be redirected to 'SignUp.html', 

SignIn.html

{% if messg %}
<script>
alert('{{ messg }}');
</script>
{% endif %}
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sign</title>
</head>
<body>
<form action="/postsign/" method="post">
{% csrf_token %}
Email :
<input type="email" name="email"><br><br>
Password:
<input type="password" name="pass"><br><br>
<input type="submit" value="SignIn">
<button type="button" onclick="location.href='{% url 'signup' %}'">SignUp</button>
</form>
</body>
</html>
A simple Signup form for creating user account, using POST operation sends user info to views.py which creates user account using pyrebase library, here if condition is added for getting invalid SignUp alert.

{% if messg %}
<script>
alert('{{ messg }}');
</script>
{% endif %}
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sign</title>
</head>
<body>
<form action="/postsignup/" method="post">
{% csrf_token %}
Name:
<input type="text" name="name"><br><br>
Email :
<input type="email" name="email"><br><br>
Password:
<input type="password" name="pass"><br><br>
<input type="submit" value="SignUp">
</form>
</body>
</html>

No comments:

Powered by Blogger.