Archived
Minor
This commit is contained in:
1 parent
b9b61a31a1
commit
b6e7945941
4 files changed
+25
-13
No files matched your search
@@ -6,8 +6,6 @@
|
||||
pip install -r requirements.txt
|
||||
cp userinfosite/settings-sample.py userinfosite/settings.py
|
||||
python manage.py syncdb
|
||||
# create the radius database tables, if they don't exist already
|
||||
python manage.py syncdb --database=radius
|
||||
python manage.py runserver
|
||||
|
||||
## LDAP
|
||||
@@ -17,13 +15,26 @@
|
||||
ldapsearch -x -b dc=neuf,dc=no
|
||||
# Login with test@example.com:test
|
||||
|
||||
## Inside
|
||||
# create the Inside database tables, if they don't exist already
|
||||
python manage.py syncdb --database=inside
|
||||
|
||||
For simple dev you need at least:
|
||||
* 1 InsideUser (din_user)
|
||||
* 1 InsideGroup (din_group)
|
||||
* 1 UserGroupRelationShip (din_usergrouprelationship)
|
||||
|
||||
## RADIUS
|
||||
# create the radius database tables, if they don't exist already
|
||||
python manage.py syncdb --database=radius
|
||||
|
||||
|
||||
# External dependencies:
|
||||
- LDAP: Read the tutorial on [Howto setup a LDAP server with Docker](https://edb.neuf.no/wiki/index.php?title=Howto_setup_a_LDAP_server_with_Docker)
|
||||
- Kerberos: TODO
|
||||
- RADIUS: TODO
|
||||
- Inside: Going away
|
||||
- Inside: Never going away! See https://git.neuf.no/edb/inside#tab-readme for code and installation
|
||||
|
||||
|
||||
# TODO
|
||||
- finish auth backend.
|
||||
- allow non LDAP-users (conditional LDAP-stuff), because we don't want LDAP filled with non-active members
|
||||
@@ -22,7 +22,7 @@ class InsideBackend(object):
|
||||
# TODO log all login attempts
|
||||
# AuthLog.objects.create()
|
||||
|
||||
if not len(inside_user) == 1:
|
||||
if len(inside_user) != 1:
|
||||
return None
|
||||
|
||||
inside_user = inside_user[0]
|
||||
|
||||
@@ -10,12 +10,12 @@ from django.utils.encoding import force_bytes
|
||||
from django.utils.http import urlsafe_base64_encode
|
||||
from django.utils.translation import ugettext as _
|
||||
import sys
|
||||
|
||||
from inside.models import InsideUser
|
||||
from inside.utils import set_inside_password
|
||||
|
||||
from models import *
|
||||
from validators import PasswordValidator
|
||||
from neuf_userinfo.models import LdapUser
|
||||
from neuf_userinfo.utils import set_kerberos_password, set_radius_password
|
||||
from neuf_userinfo.validators import PasswordValidator
|
||||
|
||||
|
||||
class NeufSetPasswordForm(SetPasswordForm):
|
||||
@@ -68,7 +68,7 @@ class NeufPasswordResetForm(PasswordResetForm):
|
||||
Generates a one-use only link for resetting password and sends to the user.
|
||||
|
||||
Note: this is the same form as django.contrib.auth.forms.PasswordResetForm
|
||||
with some changes for LDAP-lookup.
|
||||
with some changes for looking up a custom user object.
|
||||
"""
|
||||
from django.core.mail import send_mail
|
||||
for user in self.users_cache:
|
||||
|
||||
@@ -117,14 +117,15 @@ def password_reset_confirm(request, uidb64=None, token=None,
|
||||
with only minor changes for LDAP-lookup.
|
||||
"""
|
||||
assert uidb64 is not None and token is not None # checked by URLconf
|
||||
|
||||
if post_reset_redirect is None:
|
||||
post_reset_redirect = reverse('password_reset_complete')
|
||||
else:
|
||||
post_reset_redirect = resolve_url(post_reset_redirect)
|
||||
try:
|
||||
uid = urlsafe_base64_decode(uidb64)
|
||||
user = InsideUser.objects.get(pk=uid) # Diff line vs internal django view
|
||||
except (TypeError, ValueError, OverflowError, InsideUser.DoesNotExist):
|
||||
user = InsideUser.objects.get(pk=uid) # Diff vs internal Django view
|
||||
except (TypeError, ValueError, OverflowError, InsideUser.DoesNotExist): # Diff vs internal Django view
|
||||
user = None
|
||||
|
||||
if user is not None and token_generator.check_token(user, token):
|
||||
@@ -145,5 +146,5 @@ def password_reset_confirm(request, uidb64=None, token=None,
|
||||
}
|
||||
if extra_context is not None:
|
||||
context.update(extra_context)
|
||||
return TemplateResponse(request, template_name, context,
|
||||
current_app=current_app)
|
||||
|
||||
return TemplateResponse(request, template_name, context, current_app=current_app)
|
||||
Reference in new issue
Block a user