Hi,
I am currently attempting to create a guest with Combu, but I systematically fail to do so. After a bit of debugging, it seems the issue comes from the fact that the temporary username set in the function CreateRandom in Account.php has more characters that the table `Account` in the database is authorising. More precisely, here is the line of code for the temporary username in Account.php:
$new->Username = "__TEMP__".session_id() ."_".time();
When I created the database, I used the following code generated by COMBU:
CREATE TABLE IF NOT EXISTS `Account` ( `Id` bigint NOT NULL AUTO_INCREMENT, `Username` varchar(45) NOT NULL, `Password` varchar(45) NOT NULL, `LastLoginIp` varchar(255) DEFAULT NULL, `LastLoginDate` datetime DEFAULT NULL, `Email` varchar(255) DEFAULT NULL, `ActivationCode` varchar(10) DEFAULT NULL, `ChangePwdCode` varchar(10) DEFAULT NULL, `Enabled` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`Id`), UNIQUE KEY `AccountUsername` (`Username`), KEY `AccountPassword` (`Password`) ) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
which allows only 45 characters for the username.
First of all, I would appreciate if you could confirm me that this is indeed the issue.
Second, to fix it, I suppose I could either change the code for the temporary username to make it smaller (for example, by removing '__TEMP__' in the string) or increase the number of characters of `Username` in the table. Nevertheless, I am not sure which would be better. Do you have any advice?
Any help/suggestions would be appreciated.
I have actually tested the solution consisting of removing '__TEMP__' i.e. by using
$new->Username = session_id() ."_".time();
instead of
$new->Username = "__TEMP__".session_id() ."_".time();
and I could register my guest without issue. However, I would appreciate having confirmation if this solution will not cause any other issue.
Thanks
Thank you for this issue report, you can remove "__TEMP__" as you did, it will not break things. I will remove it as well since it's a quick fix for the next incoming update, but I'll also increase to 50 the length of the Username field on the database (you can already do it on your database if you want).
FRANCESCO CROCETTI @ SKARED CREATIONS
Thanks for your reply! I can go ahead without worrying now.