import os

from django.contrib.auth.middleware import RemoteUserMiddleware

class EnvRemoteUserMiddleware(RemoteUserMiddleware):
    header = os.environ.get('REMOTE_USER_HEADER', 'REMOTE_USER')

import os

from django.contrib.auth.middleware import RemoteUserMiddleware

class EnvRemoteUserMiddleware(RemoteUserMiddleware):
    header = os.environ.get('REMOTE_USER_HEADER', 'REMOTE_USER')

    def configure_user(user):
        if 'REMOTE_USER_EMAIL_SUFFIX' in os.environ:
            user.email = "{0}{1}".format(user.username, os.environ['REMOTE_USER_EMAIL_SUFFIX'])
            user.save()
        return user

Configure user's e-mail via REMOTE_USER_EMAIL_SUFFIX
sentry: Configure user's e-mail via REMOTE_USER_EMAIL_SUFFIX

  import os
  
  from django.contrib.auth.middleware import RemoteUserMiddleware
  
  class EnvRemoteUserMiddleware(RemoteUserMiddleware):
      header = os.environ.get('REMOTE_USER_HEADER', 'REMOTE_USER')
  
+     def configure_user(user):
+         if 'REMOTE_USER_EMAIL_SUFFIX' in os.environ:
+             user.email = "{0}{1}".format(user.username, os.environ['REMOTE_USER_EMAIL_SUFFIX'])
+             user.save()
+         return user
+ 
Configure user's e-mail via REMOTE_USER_EMAIL_SUFFIX
## Code Before:
import os

from django.contrib.auth.middleware import RemoteUserMiddleware

class EnvRemoteUserMiddleware(RemoteUserMiddleware):
    header = os.environ.get('REMOTE_USER_HEADER', 'REMOTE_USER')

## Instruction:
Configure user's e-mail via REMOTE_USER_EMAIL_SUFFIX
## Code After:
import os

from django.contrib.auth.middleware import RemoteUserMiddleware

class EnvRemoteUserMiddleware(RemoteUserMiddleware):
    header = os.environ.get('REMOTE_USER_HEADER', 'REMOTE_USER')

    def configure_user(user):
        if 'REMOTE_USER_EMAIL_SUFFIX' in os.environ:
            user.email = "{0}{1}".format(user.username, os.environ['REMOTE_USER_EMAIL_SUFFIX'])
            user.save()
        return user
