Search code examples
pythondjangodjango-socialauth

How to change password for Django Social auth loggedin Google+ user and facebook user?


I am using social-auth in my app. I want to provide a functionality for google+ and facebook loggedin users to change their password using django change password form but for google+ and facebook user current password is not available to change it so please anyone can help me with it.

Thanks in advance


Solution

  • Just check if the user has current password or not. If not, then hide the current password input in your template. Short example:

    {% if user.has_usable_password %}
    
        <!-- Only show current password input if user has set a password -->
        <input type="text" name="current_password">
    
    {% endif %}
    
    ...