Kola Posted June 20, 2022 Share Posted June 20, 2022 Hello, I am a newbie to Processwire. I have created a user named "user-admin" who is responsible to create new users(name,email,role). I am using EmailNewUser and ForcePasswordChange modules to auto generate password and mail it to newly registered users. I dont want to allow anyone to change/set password manually for all these users. i.e I dont want "Set Password" option accessible to anyone except that user himself. Not even user-admin or super-user should be able to change/set password of other users manually. Is this possible? and what happens in case a user forgets his password? Link to comment Share on other sites More sharing options...
Kiwi Chris Posted July 22, 2022 Share Posted July 22, 2022 There is an optional module in the core ProcessForgotPassword that you can install to enable people to reset their passwords if they forget. With regard to preventing even super-user role from changing any password other than their own, I think it could be done, but would require a hook in site/ready.php I'd imagine adding a hook before InputfieldPassword::processInput should be able to check the current user, and if they're not the same user as the password belongs to, then abandon any changes. I may not have the right hook method. A hook before Pages::save might be another option, as everything including users are 'pages' in Processwire, so the logic would be something like if($user->name != $page->name && $page->template == 'user'){ //Prevent page saving. } Someone else can probably help give a working example, or if I get time I can have a try and update my post once I've got something working. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now