prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Social Network Login Failure
  When clicking on connect GitHub on the [social accounts page](https://readthedocs.org/accounts/social/connections/?) I get a message:
  
  > An error occurred while attempting to login via your social network account.
  
  There's a `?` in the url. Could that be a hint? Is it missing some request arguments? If I omit it, the bug persists.
  
  Cheers!
  
  
  </issue>
  <code>
  [start of readthedocs/settings/postgres.py]
  1 import os
  2 
  3 from .base import *  # noqa
  4 
  5 
  6 DATABASES = {
  7     'default': {
  8         'ENGINE': 'django.db.backends.postgresql_psycopg2',
  9         'NAME': 'docs',
  10         'USER': 'postgres',  # Not used with sqlite3.
  11         'PASSWORD': '',
  12         'HOST': '10.177.73.97',
  13         'PORT': '',
  14     }
  15 }
  16 
  17 DEBUG = False
  18 TEMPLATE_DEBUG = False
  19 CELERY_ALWAYS_EAGER = False
  20 
  21 MEDIA_URL = 'https://media.readthedocs.org/'
  22 STATIC_URL = 'https://media.readthedocs.org/static/'
  23 ADMIN_MEDIA_PREFIX = MEDIA_URL + 'admin/'
  24 SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
  25 
  26 HAYSTACK_CONNECTIONS = {
  27     'default': {
  28         'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
  29         'URL': 'http://odin:8983/solr',
  30     }
  31 }
  32 
  33 CACHES = {
  34     'default': {
  35         'BACKEND': 'redis_cache.RedisCache',
  36         'LOCATION': 'localhost:6379',
  37         'PREFIX': 'docs',
  38         'OPTIONS': {
  39             'DB': 1,
  40             'PARSER_CLASS': 'redis.connection.HiredisParser'
  41         },
  42     },
  43 }
  44 
  45 # Elasticsearch settings.
  46 ES_HOSTS = ['backup:9200', 'db:9200']
  47 ES_DEFAULT_NUM_REPLICAS = 1
  48 ES_DEFAULT_NUM_SHARDS = 5
  49 
  50 SLUMBER_API_HOST = 'https://readthedocs.org'
  51 WEBSOCKET_HOST = 'websocket.readthedocs.org:8088'
  52 
  53 PRODUCTION_DOMAIN = 'readthedocs.org'
  54 USE_SUBDOMAIN = True
  55 NGINX_X_ACCEL_REDIRECT = True
  56 
  57 SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
  58 
  59 # Lock builds for 10 minutes
  60 REPO_LOCK_SECONDS = 300
  61 
  62 # Don't re-confirm existing accounts
  63 ACCOUNT_EMAIL_VERIFICATION = 'none'
  64 
  65 FILE_SYNCER = 'privacy.backends.syncers.DoubleRemotePuller'
  66 
  67 # set GitHub scope
  68 SOCIALACCOUNT_PROVIDERS = {
  69     'github': {'SCOPE': ['user:email', 'read:org', 'admin:repo_hook', 'repo:status']}
  70 }
  71 
  72 if not os.environ.get('DJANGO_SETTINGS_SKIP_LOCAL', False):
  73     try:
  74         from local_settings import *  # noqa
  75     except ImportError:
  76         pass
  77
  [end of readthedocs/settings/postgres.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/readthedocs/settings/postgres.py b/readthedocs/settings/postgres.py
  --- a/readthedocs/settings/postgres.py
  +++ b/readthedocs/settings/postgres.py
  @@ -69,6 +69,9 @@
       'github': {'SCOPE': ['user:email', 'read:org', 'admin:repo_hook', 'repo:status']}
   }
   
  +# allauth settings
  +ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'https'
  +
   if not os.environ.get('DJANGO_SETTINGS_SKIP_LOCAL', False):
       try:
           from local_settings import *  # noqa
  
verification_info: {"golden_diff": "diff --git a/readthedocs/settings/postgres.py b/readthedocs/settings/postgres.py\n--- a/readthedocs/settings/postgres.py\n+++ b/readthedocs/settings/postgres.py\n@@ -69,6 +69,9 @@\n     'github': {'SCOPE': ['user:email', 'read:org', 'admin:repo_hook', 'repo:status']}\n }\n \n+# allauth settings\n+ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'https'\n+\n if not os.environ.get('DJANGO_SETTINGS_SKIP_LOCAL', False):\n     try:\n         from local_settings import *  # noqa\n", "issue": "Social Network Login Failure\nWhen clicking on connect GitHub on the [social accounts page](https://readthedocs.org/accounts/social/connections/?) I get a message:\n\n> An error occurred while attempting to login via your social network account.\n\nThere's a `?` in the url. Could that be a hint? Is it missing some request arguments? If I omit it, the bug persists.\n\nCheers!\n\n", "before_files": [{"content": "import os\n\nfrom .base import *  # noqa\n\n\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.postgresql_psycopg2',\n        'NAME': 'docs',\n        'USER': 'postgres',  # Not used with sqlite3.\n        'PASSWORD': '',\n        'HOST': '10.177.73.97',\n        'PORT': '',\n    }\n}\n\nDEBUG = False\nTEMPLATE_DEBUG = False\nCELERY_ALWAYS_EAGER = False\n\nMEDIA_URL = 'https://media.readthedocs.org/'\nSTATIC_URL = 'https://media.readthedocs.org/static/'\nADMIN_MEDIA_PREFIX = MEDIA_URL + 'admin/'\nSESSION_ENGINE = \"django.contrib.sessions.backends.cached_db\"\n\nHAYSTACK_CONNECTIONS = {\n    'default': {\n        'ENGINE': 'haystack.backends.solr_backend.SolrEngine',\n        'URL': 'http://odin:8983/solr',\n    }\n}\n\nCACHES = {\n    'default': {\n        'BACKEND': 'redis_cache.RedisCache',\n        'LOCATION': 'localhost:6379',\n        'PREFIX': 'docs',\n        'OPTIONS': {\n            'DB': 1,\n            'PARSER_CLASS': 'redis.connection.HiredisParser'\n        },\n    },\n}\n\n# Elasticsearch settings.\nES_HOSTS = ['backup:9200', 'db:9200']\nES_DEFAULT_NUM_REPLICAS = 1\nES_DEFAULT_NUM_SHARDS = 5\n\nSLUMBER_API_HOST = 'https://readthedocs.org'\nWEBSOCKET_HOST = 'websocket.readthedocs.org:8088'\n\nPRODUCTION_DOMAIN = 'readthedocs.org'\nUSE_SUBDOMAIN = True\nNGINX_X_ACCEL_REDIRECT = True\n\nSECURE_PROXY_SSL_HEADER = (\"HTTP_X_FORWARDED_PROTO\", \"https\")\n\n# Lock builds for 10 minutes\nREPO_LOCK_SECONDS = 300\n\n# Don't re-confirm existing accounts\nACCOUNT_EMAIL_VERIFICATION = 'none'\n\nFILE_SYNCER = 'privacy.backends.syncers.DoubleRemotePuller'\n\n# set GitHub scope\nSOCIALACCOUNT_PROVIDERS = {\n    'github': {'SCOPE': ['user:email', 'read:org', 'admin:repo_hook', 'repo:status']}\n}\n\nif not os.environ.get('DJANGO_SETTINGS_SKIP_LOCAL', False):\n    try:\n        from local_settings import *  # noqa\n    except ImportError:\n        pass\n", "path": "readthedocs/settings/postgres.py"}]}