Commit 5abb6d99 by Alfiro Pratama

fix login trait reviewer

parent 056bb2e7
......@@ -57,7 +57,7 @@ class BiodataRepository
// ubah novan karena ambil email dari isdm saja jangan dari auth;
// $data['email'] = $auth[0]->email;
// $data['noid'] = $isdm[0]->nip;
$data['email'] = $auth[0]->email;
$data['email'] = $auth[0]->email ?? $isdm[0]->email;
$data['name'] = $isdm[0]->nama;
$data['noid'] = $isdm[0]->nidn ?? $isdm[0]->nuptk;
if ($isdm[0]->isdosen == 0) {
......
......@@ -42,14 +42,26 @@ trait LoginTrait
private function getAddReviewer($nip)
{
$id = (string) Str::uuid();
$data = collect([
(object) [
'jenis' => 'P',
'userid' => $nip
]
'userid' => $nip,
],
]);
$biodata = $this->biodataRepo->biodata($data->toArray());
// User sudah terdaftar (mis. sebagai dosen) dengan email sama, tetapi noidentitas beda dengan NIDN yang dipakai di sini — hindari duplicate users.email
$email = isset($biodata['email']) ? trim((string) $biodata['email']) : '';
if ($email !== '') {
$existingByEmail = $this->userRepo->find(null, null, $email);
if ($existingByEmail) {
$this->createRole($existingByEmail->id);
return 'sukses';
}
}
$id = (string) Str::uuid();
$user = $this->userRepo->storeSso($id, $biodata);
$roles = $this->roleRepo->roles('reviewer');
$this->userDetailRepo->storeSso($user->id, $biodata);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment