web_programming.recaptcha_verification

Recaptcha is a free captcha service offered by Google in order to secure websites and forms. At https://www.google.com/recaptcha/admin/create you can create new recaptcha keys and see the keys that your have already created. * Keep in mind that recaptcha doesn’t work with localhost When you create a recaptcha key, your will get two separate keys: ClientKey & SecretKey. ClientKey should be kept in your site’s front end SecretKey should be kept in your site’s back end

# An example HTML login form with recaptcha tag is shown below

<form action=”” method=”post”>

<h2 class=”text-center”>Log in</h2> {% csrf_token %} <div class=”form-group”>

<input type=”text” name=”username” required=”required”>

</div> <div class=”form-group”>

<input type=”password” name=”password” required=”required”>

</div> <div class=”form-group”>

<button type=”submit”>Log in</button>

</div> <!– Below is the recaptcha tag of html –> <div class=”g-recaptcha” data-sitekey=”ClientKey”></div>

</form>

<!– Below is the recaptcha script to be kept inside html tag –> <script src=”https://www.google.com/recaptcha/api.js” async defer></script>

Below a Django function for the views.py file contains a login form for demonstrating recaptcha verification.

Functions

login_using_recaptcha(request)

Module Contents

web_programming.recaptcha_verification.login_using_recaptcha(request)