Initial import of tasks application
This initial import is a heavily modified version of the code I had here, as Arse was modified for other purposes in the meantime and the application no longer worked with it. In addition: * I did not import the user management part yet, * task dependencies are supported in-base, but there is no interface for that yet.
This commit is contained in:
commit
9677ad4dd3
36 changed files with 3919 additions and 0 deletions
includes/t-users
43
includes/t-users/users.inc.php
Normal file
43
includes/t-users/users.inc.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
|
||||
class Dao_Users
|
||||
extends DAO
|
||||
{
|
||||
private function hashPassword( $password , $salt , $iterations )
|
||||
{
|
||||
$hash = $password;
|
||||
$salt = trim( $salt );
|
||||
do {
|
||||
$hash = sha1( "$salt$hash$salt" );
|
||||
$iterations --;
|
||||
} while ( $iterations > 0 );
|
||||
return $hash;
|
||||
}
|
||||
|
||||
|
||||
public function getUser( $email )
|
||||
{
|
||||
$query = $this->query( 'SELECT * FROM users WHERE user_email = LOWER( $1 )' );
|
||||
$results = $query->execute( $email );
|
||||
if ( empty( $results ) ) {
|
||||
return null;
|
||||
}
|
||||
return array_shift( $results );
|
||||
}
|
||||
|
||||
|
||||
public function checkLogin( $email , $password )
|
||||
{
|
||||
$userData = $this->getUser( $email );
|
||||
if ( $userData != null ) {
|
||||
$hashed = $this->hashPassword( $password ,
|
||||
$userData->user_salt ,
|
||||
$userData->user_iterations );
|
||||
if ( $hashed === $userData->user_hash ) {
|
||||
return $userData;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue