Overhauls discord verification system (#53289)

This completely replaces the previous verification system, for one that
will interoperate with a discord redbot instance that uses the cogs
located at you github.com/optimumtact/orangescogs

This cuts out several steps in the system, but it also leaves alone the
existing notify system (which just uses a file list of discord ids) as a
record of who to notify

SQL changes required for the new database system

Version 5.10, 7 August 2020, by oranges

Changes how the discord verification process works.
Adds the discord_links table, and migrates discord id entries from
player table to the discord links table in a once off operation and then
removes the discord id on the player table

The user connects to any tg server, and uses the "Verify Discord
Account" verb, this generates a six word one time use token, with a 4
hour time validity period (defined as 4 hours from the timestamp value)
in the discord links table.

This one time token, and the ckey of the user are stored in
discord_links

At this point the entire DM side is done, this is all it does
This commit is contained in:
oranges
2020-08-30 18:24:23 -07:00
committed by GitHub
parent 42e8ddea42
commit 6c9d88a4cd
15 changed files with 327 additions and 252 deletions
+14 -1
View File
@@ -322,7 +322,6 @@ CREATE TABLE `SS13_player` (
`lastadminrank` varchar(32) NOT NULL DEFAULT 'Player',
`accountjoindate` DATE DEFAULT NULL,
`flags` smallint(5) unsigned DEFAULT '0' NOT NULL,
`discord_id` BIGINT(20) NULL DEFAULT NULL,
PRIMARY KEY (`ckey`),
KEY `idx_player_cid_ckey` (`computerid`,`ckey`),
KEY `idx_player_ip_ckey` (`ip`,`ckey`)
@@ -574,6 +573,20 @@ END
$$
DELIMITER ;
--
-- Table structure for table `discord_links`
--
DROP TABLE IF EXISTS `SS13_discord_links`;
CREATE TABLE `SS13_discord_links` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ckey` VARCHAR(32) NOT NULL,
`discord_id` BIGINT(20) DEFAULT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`one_time_token` VARCHAR(100) NOT NULL,
`valid` BOOLEAN NOT NULL DEFAULT FALSE,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;