I am trying to implement google allauth authentication.
Before clicking this button to make google register a user:
<a href="{% provider_login_url 'google' %}" type="submit">Registrarse with Google</a>
I have this input field
<input id="nombrelink" placeholder="specialname"></input>
What that button does is automatically register and log the user in.
I would like to pass this input parameter to the google button so that whenever someone creates an account, that inputs gets prepended to their database
How can I pass an extra argument to that url?
You can append the parameter to the url using jQuery for example.
$('#nombrelink').change(function(){
var href = $('#provider-url').attr('href');
//This is the new href attr
var new_href = href +'?nombrelink='+ $(this).val();
$('#provider-url').attr('href',new_href);
console.log($('#provider-url').attr('href'));
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<a id="provider-url" href="/provider-login-url/google" type="submit">Registrarse con Google</a>
<input id="nombrelink" placeholder="specialname"></input>
Then in your view, you can access that parameter through request:
#inside your view
nombrelink = request.GET.get('nombrelink')