Commit f17221ac authored by Pål Karlsrud's avatar Pål Karlsrud

Don't attempt to fetch groups if oauth is not used.

parent ae96ec49
......@@ -24,7 +24,10 @@ class UserHooks {
public function register() {
$callback = function($user) {
$groups = $this->fetchGroups($this->session->get('oauth_access_token'));
$oauth_token = $this->session->get('oauth_access_token');
if (!$oauth_token) return;
$groups = $this->fetchGroups($oauth_token);
if (!is_array($groups)) throw new LoginException("Failed to fetch MAS projects.");
if (empty($groups)) throw new LoginException("You must be member of a MAS project in order to use this service.");
......
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