Don't crash when unauthenticated users try to change password
authorMagnus Hagander <magnus@hagander.net>
Mon, 28 Aug 2017 15:07:58 +0000 (17:07 +0200)
committerMagnus Hagander <magnus@hagander.net>
Mon, 28 Aug 2017 15:07:58 +0000 (17:07 +0200)
pgweb/account/views.py

index d9b9152e6b1e9fa059673c4536e2c3c7b451e417..d282e9ff5b50af2f50dd2fc6e470e727d253180c 100644 (file)
@@ -226,7 +226,7 @@ def logout(request):
        return authviews.logout_then_login(request, login_url='/')
 
 def changepwd(request):
-       if request.user.password == OAUTH_PASSWORD_STORE:
+       if hasattr(request.user, 'password') and request.user.password == OAUTH_PASSWORD_STORE:
                return HttpServerError("This account cannot change password as it's connected to a third party login site.")
 
        log.info("Initiating password change from {0}".format(get_client_ip(request)))