Issue when creating...
 
Notifications
Clear all

Issue when creating guest (possibly due to the number of characters in the temporary username which is too large)

4 Posts
2 Users
0 Reactions
382 Views
(@fry000)
Posts: 3
Active Member
Topic starter
 

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();
which, for example, yielded the following string '__TEMP__4c8a351f8a0a3ade76ba2574b06bb842_1604012417' composed of 51 characters (if I have counted correctly).

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.

 

 
Posted : 30/10/2020 12:42 am
(@fry000)
Posts: 3
Active Member
Topic starter
 

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

 
Posted : 30/10/2020 12:51 am
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

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

 
Posted : 30/10/2020 10:44 am
(@fry000)
Posts: 3
Active Member
Topic starter
 

Thanks for your reply! I can go ahead without worrying now.

 
Posted : 31/10/2020 12:35 am
Share: