Home > front end >  Can the "super-user" assign a "common password" to a user, regardless?
Can the "super-user" assign a "common password" to a user, regardless?

Time:01-19

I would think that the "super user" should be entitled to assign any password to another user that they want to assign, whether or not it is "common." But the software does not seem to agree. Is there any way to allow a "super user" to impose such an override, if they please?

CodePudding user response:

if a superuser wants to assign a password that does not meet these rules, you can override the validation by calling the set_password() method on the user object and passing validate=False. however, I don't believe why is this use case in your SW anyway

I think this will solve it.

user = User.objects.get(username='username')

#Assign a new password, but bypass the password validation

user.set_password('newpassword', validate=False)
user.save()

CodePudding user response:

Of course I know that "programmatic" solutions exist ... but I'm only looking at the admin user interface.

I suppose the answer to my question is simply: "no." I was hoping that someone, when designing the original admin screen, would have thought of this and thought that it was as good of an idea as I think it is, but I guess they didn't. So be it. "Case closed."

"Thanks, community ..."

  • Related