make password reset work and verify timecodes
[authserver.git] / authsystem.inc.php
... / ...
CommitLineData
1<?php
2// error reporting (for testing)
3ini_set('display_errors', 1); error_reporting(E_ALL);
4
5// Read DB settings
6$dbdata = json_decode(file_get_contents('/etc/kairo/auth_db.json'), true);
7if (!is_array($dbdata)) { trigger_error('DB configuration not found', E_USER_ERROR); }
8
9$pwd_options = array('cost' => 10);
10
11// Extended DOM document class
12require_once('../kairo/include/cbsm/util/document.php-class');
13// Class for sending emails
14require_once('../kairo/include/classes/email.php-class');
15
16bindtextdomain('kairo_auth', 'en'); // XXX: Should negotiate locale.
17bind_textdomain_codeset('kairo_auth', 'utf-8');
18
19// Connect to our MySQL DB
20$db = new PDO($dbdata['dsn'], $dbdata['username'], $dbdata['password']);
21
22/* Creating the DB tables:
23CREATE TABLE `auth_sessions` ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT , `sesskey` VARCHAR(150) NOT NULL DEFAULT '' , `user` MEDIUMINT UNSIGNED NULL DEFAULT NULL , `logged_in` BOOLEAN NOT NULL DEFAULT FALSE , `time_created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , `time_expire` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (`id`), INDEX (`sesskey`), INDEX (`time_expire`));
24CREATE TABLE `auth_users` ( `id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT , `email` VARCHAR(255) NOT NULL , `pwdhash` VARCHAR(255) NOT NULL , `status` ENUM('unverified','ok') NOT NULL DEFAULT 'unverified' , `verify_hash` VARCHAR(150) NULL DEFAULT NULL , PRIMARY KEY (`id`), UNIQUE (`email`));
25*/
26
27// include our OAuth2 Server object
28require_once(__DIR__.'/server.inc.php');
29?>