I am working on an application in laravel that connects to a database of another platform that is in MOODLE. Anyway .. I'm trying to make a login, for that I point my model User.php to the table mdl_user .. This login I had already done one time for another platform but I think this is different .. well I think it does not use simply MD5 to encrypt your keys .. I read in the documentation of moodle 2.4 that use MD5 with salt. I really do not know him because I'm new to all of this. My question is, how can I make Laravel read the hash that is in md5 with salt? or is there a magic function in laravel that reads all the hashes that exist haha ?, any help serves me .. Obs: Do not ask me to use bycript, I know it's safer but it's requested by the client, thanks My model is:
<?php
namespace App;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $table = 'mdl_user';
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
}
And this is my EloquentUserProvider that I modified to work with md5
public function validateCredentials(UserContract $user, array $credentials)
{
$plain = $credentials['password'];
if (md5($plain) == $user->getAuthPassword()) {
return true;
# code...
} else {
return false;
}
// return $this->hasher->check($plain, $user->getAuthPassword());
}