I have built a new plugin which saves user to the backend with certain permissions. But when I have to update the created users in the plugin, I have to enter the password each time. So I thought of fetching the password for that particular user from the Db using a query, then unhash the password and save the same:
public function beforeSave(){
$savedpassword = DB::select("Select password from backend_users where first_name = ' ".$this->first_name." ' ");
$user = BackendAuth::register([
'first_name' => $this->firstname,
'last_name' => $this->lastname,
'login' => $this->login,
'email' => $this->email,
'password' => $savedpassword,
'password_confirmation' => $savedpassword,
]);
}
But I am not able to unhash the password using :
use Illuminate\Contracts\Encryption\DecryptException;
try { $decrypted = Crypt::decrypt($encryptedValue); } catch (DecryptException $ex) { // }
or even save the $savedpassword in the Db, i get an error
Last updated