Example #1
0
 protected function signIn($cookieExp)
 {
     if (!$this->getOrganisations()->hasRows()) {
         throw new UserException('The user do not belong to any organisation.', 50);
     }
     parent::signIn($cookieExp);
 }
Example #2
0
 public function signout()
 {
     if (ModelUser::isLoggedIn()) {
         ModelUser::current()->signOut();
         $this->setMessage('Thanks for visiting!', 'success');
     }
     redirect(url('home'));
 }
 public function __construct()
 {
     $table = new DBTable();
     $table->column('id')->bigint()->primary()->increment();
     $table->column('user_id')->bigint()->index();
     $table->column('organisation_id')->bigint()->index();
     $table->column('invoice_id')->integer()->index();
     $table->column('path')->string(300);
     $table->column('due_date')->date()->index();
     $table->column('amount_total')->integer()->index();
     $table->column('payed')->bool()->index();
     $table->column('created')->datetime()->index();
     parent::__construct($table);
     if (ModelUser::current()->isLoggedIn()) {
         $this->user_id = ModelUser::current()->id;
     }
     $this->created = Date::toDateTime();
 }
Example #4
0
        exit(0);
        break;
    case 'password:create':
        $argv = array_slice($argv, 2);
        if (!isset($argv[0])) {
            die('Error: missing required parameter [input password]');
        }
        echo sprintf('New password: %s', password_hash($argv[0], PASSWORD_DEFAULT)) . chr(10);
        echo chr(10);
        exit(0);
        break;
    case 'password:reset':
        $argv = array_slice($argv, 2);
        if (!isset($argv[0])) {
            die('Error: missing required parameter [user id]');
        }
        $user = \Pecee\Model\ModelUser::findOrfail($argv[0]);
        if ($user === null) {
            echo sprintf('User with id %s not found', $argv[0]) . chr(10);
        } else {
            $password = \Pecee\Guid::createRandomPassword(8);
            $user->setPassword($password);
            $user->save();
            echo sprintf('Password changed for %s to: %s', $user->username, $password) . chr(10);
        }
        echo chr(10);
        exit(0);
        break;
}
echo 'No input specified';
exit(1);