2

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

Dan
  • 6,008
  • 7
  • 40
  • 41
Nikhil Agrawal
  • 285
  • 1
  • 3
  • 12

1 Answers1

10

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();
alou
  • 1,432
  • 13
  • 16
  • oh..that simple..Let me try.. Thanks :) – Nikhil Agrawal Oct 21 '13 at 12:26
  • Do you have any ideas, how to add some more constrain while authentication in sentry 2, I have a company table and users belongs to that company, and if the company is disabled then the user should not be able to login...Please help if u have any idea about it. Thanks :) – Nikhil Agrawal Oct 21 '13 at 12:28
  • 1
    @NikhilAgrawal, this is a totally different issue that deserves a new question, with details on at least your models implementation and what you mean by disabled - my first thought would be to use a filter with a companyEnabled() method in User model. Shouldn't the answer get accepted? Cheers. – alou Oct 21 '13 at 12:46
  • http://stackoverflow.com/questions/19495087/adding-more-constrain-in-sentry-2-authentication-processs – Nikhil Agrawal Oct 21 '13 at 12:53
  • You should accept correct answers if you are expecting people to reply to more questions... – alou Oct 21 '13 at 13:03