This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
pam-django/check-password

20 lines
502 B
Python
Executable File

#!/usr/bin/python
import logging
import logging.handlers
import sys
log = logging.getLogger()
log.setLevel(logging.DEBUG)
log.addHandler(logging.handlers.SysLogHandler(address = '/dev/log'))
try:
from django.contrib.auth import authenticate
user, password = sys.argv[1:3]
user = authenticate(username=unicode(user, 'utf-8'), password=unicode(password, 'utf-8'))
except:
log.exception('django.contrib.auth.authenticate raised an exception')
else:
if user is None:
sys.exit(1)
sys.exit(0)