import pam

from django.contrib.auth import models as auth_models

class User(auth_models.User):
    class Meta:
        proxy = True
    def check_password(self, raw_password):
        return pam.authenticate(self.username, raw_password)
    

# Monkey-patch User model
auth_models.User = User
import dpam.pam

from django.contrib.auth import models as auth_models

class User(auth_models.User):
    class Meta:
        proxy = True
    def check_password(self, raw_password):
        return dpam.pam.authenticate(self.username, raw_password)
    

# Monkey-patch User model
auth_models.User = User

Use django_pams pam.authenticate, instead of some other pam module.
Use django_pams pam.authenticate, instead of some other pam module.

- import pam
+ import dpam.pam
  
  from django.contrib.auth import models as auth_models
  
  class User(auth_models.User):
      class Meta:
          proxy = True
      def check_password(self, raw_password):
-         return pam.authenticate(self.username, raw_password)
+         return dpam.pam.authenticate(self.username, raw_password)
      
  
  # Monkey-patch User model
  auth_models.User = User
+ 
Use django_pams pam.authenticate, instead of some other pam module.
## Code Before:
import pam

from django.contrib.auth import models as auth_models

class User(auth_models.User):
    class Meta:
        proxy = True
    def check_password(self, raw_password):
        return pam.authenticate(self.username, raw_password)
    

# Monkey-patch User model
auth_models.User = User
## Instruction:
Use django_pams pam.authenticate, instead of some other pam module.
## Code After:
import dpam.pam

from django.contrib.auth import models as auth_models

class User(auth_models.User):
    class Meta:
        proxy = True
    def check_password(self, raw_password):
        return dpam.pam.authenticate(self.username, raw_password)
    

# Monkey-patch User model
auth_models.User = User
