Skip to content

Commit bdf6970

Browse files
committed
Adjusted login logic
1 parent e350f6b commit bdf6970

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/snapchat.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,17 @@ public function login($username, $password) {
105105
)
106106
);
107107

108-
// If 'logged' is true (aka successful login), set the username and auth_token
109-
if ($result->logged) {
110-
$this->username = $result->username;
108+
// If the login is successful, set the username and auth_token.
109+
if (isset($result->logged) && $result->logged) {
111110
$this->auth_token = $result->auth_token;
112-
}
111+
$this->username = $result->username;
113112

114-
// Set cache
115-
if (!empty($result)) {
116113
$this->cache = new SnapchatCache();
117114
$this->cache->set('updates', $result);
118115
}
119-
120-
return $result;
116+
else {
117+
return FALSE;
118+
}
121119
}
122120

123121
/**
@@ -1178,4 +1176,4 @@ public function updateEmail($email) {
11781176
return isset($result->param) && $result->param == $email;
11791177
}
11801178

1181-
}
1179+
}

0 commit comments

Comments
 (0)