-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce password changes #7
Comments
You're right! But as I'm busy this might take a couple of days to work on. Did you already think about how to implement it? Suggestions are welcome... |
middleware.py, line 60 This is code that works for me: This is a hack that would work, thought there must be a muct better way |
I've actually thought about it. As I'm using customized User models a lot I don't want to rely on User model fields like
I've added a model with a 1-to-1 relationship to auth.User. I'm already extending the middleware. I'm trying to not interfere with the User model to keep the password_policies app as "stand-alone" as possible. Taking your suggestion a little bit further than you've intended I will also change the subject of this issue. Hope you don't mind... |
Great! |
That's why I added an admin action. In the admin interface you can decide if you just reset the password and/or trigger the admin action to enforce a password change after having reset the password. What I haven't thought about is if the user is supposed to change his/her password instantly or after he/she logs in again... That might be worth another setting, actually... What do you think? If you want to have a checkbox on the admin passwort reset view you could use your own form to do so:
Then you could define your own password reset view for the admin interface. There you could test if the user who's resetting the password resets his/her own or another user's password. Based on that you could decide to use the form example written above or the normal password reset form. You wouldn't want to enforce a password change on yourself if you just changed your own password, would you? |
Well, the project that I am working on at the moment is health related |
Can you reread my comment? I've just updated it... |
Well, admin+grappelli has two views for changing password, one is from the status bar of the admin interface (admin/password_change/), so you change your own password, the other one is through user object (admin/auth/user/1/password/). So, if admin changes his own password through the latter interface, yes, I would force him to change it again. And in this particular instance of FDA and EMEA rules, strictly speaking, admin must not have this choice. I know, distrusting admin seems strange, but those are the rules. We are used that admins in Django are also system administrators, but in big systems this is not the case. And often this would be against safety protocols. I do not wish to be ungrateful, this is a great thing you do. But I have to go now and will be back on Tuesday. |
OK. Well, to force a password change all you will have to do is to create an
This could be done while creating a user or after having changed his/her password. The middleware would search for entries in the PasswordChangeRequired database table and, if one is found, redirect the user to the password change view. |
I've just commited the changes so far. If you want to have a look... I would appreciate your opinion on what I've done... Maybe there's something I haven't thought about... |
I suggest a Setting that forces password changes on first login, as this is required by many safety standards.
The text was updated successfully, but these errors were encountered: