Ignore:
Timestamp:
03/04/12 15:48:42 (13 years ago)
Author:
hendrikvanantwerpen
Message:

[Server] Refactored model classes with some meta-programming. Specific classes only define their fields and inherit from class RdfObject?. Changes to handle the new model objects correctly.
[Client] Added rft/store module for uniform resource access. Removed dependencies on 'uid' field name. Added support for references without loading full object nor exposing uri.
[Client] Added reset() to QuestionWidget?.
[RDFAPI] Fixed PHP warning.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/branches/rest-dojo-ui/server/classes/Auth.php

    r274 r303  
    77    public static function register($email, $password) {
    88        $user_results = User::get(array("email" => $email));
    9         if ( !empty($user_results) ) {
     9        if (!empty($user_results)) {
    1010            throw new Exception("User with email $email already exists.");
    1111        }
    1212        $salt = rand();
    13         $user = new User(null,$email,sha1($password.$salt),$salt);
     13        $user = new User(null, array(
     14                    'email' => $email,
     15                    'passwordHash' => sha1($password . $salt),
     16                    'passwordSalt' => $salt));
    1417        $user->save();
    1518        return $user;
    1619    }
    17    
     20
    1821    public static function login($email, $password) {
    1922        $user_results = User::get(array("email" => $email));
     
    2225        }
    2326        $user = $user_results[0];
    24         if (sha1($password.$user->passwordSalt) != $user->passwordHash) {
     27        if (sha1($password . $user->passwordSalt) != $user->passwordHash) {
    2528            throw new Exception("Wrong password.");
    2629        }
     
    3538        return $user_results[0];
    3639    }
    37    
     40
    3841}
    3942
Note: See TracChangeset for help on using the changeset viewer.