Last change
on this file since 271 was
256,
checked in by hendrikvanantwerpen, 13 years ago
|
Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).
|
File size:
612 bytes
|
Rev | Line | |
---|
[256] | 1 | <?php |
---|
| 2 | |
---|
| 3 | require_once 'master.php'; |
---|
| 4 | |
---|
| 5 | class Auth { |
---|
| 6 | |
---|
| 7 | public static function login($username, $password) { |
---|
| 8 | $user_results = User::get(array("name" => $username)); |
---|
| 9 | if (!empty($user_results)) { |
---|
| 10 | $user = $user_results[0]; |
---|
| 11 | if (sha1($password) == $user->password) { |
---|
| 12 | return $user; |
---|
| 13 | } |
---|
| 14 | } |
---|
| 15 | return false; |
---|
| 16 | } |
---|
| 17 | |
---|
| 18 | public static function restore($session) { |
---|
| 19 | $user_results = User::get(array("uid" => $session)); |
---|
| 20 | if (!empty($user_results)) { |
---|
| 21 | return $user_results[0]; |
---|
| 22 | } |
---|
| 23 | return false; |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.