Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sentry 2 , change password functionality

I am using sentry2 as a ACL bundle for my project in laravel 4.

I have a 'super admin' user who manages every user and can edit their details. I want that the super admin should also be able to change the password for a particular user.

I know, i can use the reset password feature which will send the reset code to that user, but its not exactly what i need.

Have any one use such functionality ?

Thanks in advance, Nikhil

like image 994
Nikhil Agrawal Avatar asked Jun 13 '26 01:06

Nikhil Agrawal


1 Answers

After getting the new pass input, let's call it $newPass, it's as easy as:

 $user = Sentry::getUserProvider()->findById(1);
 $user->password = $newPass; 
 $user->save();
like image 181
alou Avatar answered Jun 15 '26 01:06

alou



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!