12-30-2017, 05:05 AM
Hello all,
Hoping you all will be able to help with this.
The website I am developing is using Userspice. The website; however, is a part of a larger organization that requires logins to be handled by their central server via a JSON Web Token. After the login is successful, it passes the user's email, username, and a few other JSON fields back to our Userspice website. The email and username that is passed back from the central server will need to be verified with our Userspice user database, and if there is a match, a session will be created.
I was wondering how to go about this? I begun messing with the User.php file, but had issues editing the loginEmail function. I attempted to remove the password verification to just do it solely off of the email passed back to the website and it did not work:
<pre></pre>
The login page is as follows, after getting the JSON fields:
<pre></pre>
I am not getting any data back in the $login variable. Any help would be greatly appreciated. Thank you!
Hoping you all will be able to help with this.
The website I am developing is using Userspice. The website; however, is a part of a larger organization that requires logins to be handled by their central server via a JSON Web Token. After the login is successful, it passes the user's email, username, and a few other JSON fields back to our Userspice website. The email and username that is passed back from the central server will need to be verified with our Userspice user database, and if there is a match, a session will be created.
I was wondering how to go about this? I begun messing with the User.php file, but had issues editing the loginEmail function. I attempted to remove the password verification to just do it solely off of the email passed back to the website and it did not work:
<pre>
Code:
public function logincentral ($email = null){
if (!$email && $this->exists()) {
Session::put($this->_sessionName, $this->data()->id);
} else {
$user = $this->find($email);
if ($user) {
Session::put($this->_sessionName, $this->data()->id);
$date = date("Y-m-d H:i:s");
$this->_db->query("UPDATE users SET last_login = ?, logins = logins + 1 WHERE id = ?",[$date,$this->data()->id]);
$this->_db->query("UPDATE users SET last_confirm = ? WHERE id = ?",[$date,$this->data()->id]);
$ip = ipCheck();
$q = $this->_db->query("SELECT id FROM us_ip_list WHERE ip = ?",array($ip));
$c = $q->count();
if($c < 1){
$this->_db->insert('us_ip_list', array(
'user_id' => $this->data()->id,
'ip' => $ip,
));
}else{
$f = $q->first();
$this->_db->update('us_ip_list',$f->id, array(
'user_id' => $this->data()->id,
'ip' => $ip,
));
}
return true;
}
}
return false;
}
The login page is as follows, after getting the JSON fields:
<pre>
Code:
$user = new User();
$login = $user->loginULS($controller_email);
I am not getting any data back in the $login variable. Any help would be greatly appreciated. Thank you!