opensupports/server/models/User.php

34 lines
839 B
PHP
Raw Normal View History

<?php
use RedBeanPHP\Facade as RedBean;
class User extends DataStore {
const TABLE = 'user';
public static function authenticate($userEmail, $userPassword) {
$user = User::getUser($userEmail, 'email');
return ($user && Hashing::verifyPassword($userPassword, $user->password)) ? $user : null;
}
public static function getProps() {
return array(
'email',
'password',
'name',
'verificationToken'
);
}
2016-05-15 01:22:46 +02:00
public function getDefaultProps() {
return array();
}
public function addTicket(Ticket $ticket) {
$this->getBeanInstance()->sharedTicketList[] = $ticket->getBeanInstance();
}
public static function getUser($value, $property = 'id') {
return parent::getDataStore($value, $property);
}
}