The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can not signin with username is number
#1
If the username is number example: (123456), I can not login.

help me! thanks
  Reply
#2
I can confirm this. I just tried and a username of
123456 does not work but a username beginning with a number, does (ie 1user).

Investigating now.
  Reply
#3
I'm kind of at a loss right now on that one. It's obvious that an initial problem was that if a username is numeric, it looks up the user by their id. I fixed that on my system and can get it to find a user, but I cannot get a user with a purely numeric username to login. I'll keep looking when my eyes are fresher. Sorry about that. I've never come across this issue.
  Reply
#4
Thanks you for sppport
  Reply
#5
The problem is (was?) in User::find().

Code such as this will solve the problem:

if (is_numeric($user) && $user < 10000) {
user_id...
} else {
...

(Sent previously in PM to mudmin, including here for documentation purposes)
  Reply
#6
Good call on that one.
  Reply
#7
Hello! Thank you for this excellent framework!
I got this same problem, I need the username to be just numbers (the personal ID of students) and the numbers may be between 11000000 and 50000000. I create the users but I can't log in. Is this already solved or is a fact that the framework cannot handle purely numeric usernames to login?
Thank you!!
  Reply
#8
There is a trick to it. Because the system will allow you to use your user id instead of username or email, it's looking for the user id. Maybe the best thing.

This is one of the VERY rare times I would tell you to just edit a system file.

If you look at line 57 of users/classes/Users.php you'll see that if the username is numeric, it is looking in the id field.

Change that to username.

You'll obviously have to test it, but that should do the trick. Then just look out for updates that update the user class which is REALLY rare.
  Reply
#9
I tried but now I can't log in with any user. Maybe I have to modify Validate class? And I don't know where to activate an error log to see what is wrong at login time.
Thank you for your time!
  Reply
#10
Even more, I commented the IF lines on User.php like this:
public function find($user = null){
if ($user) {
/*if(is_numeric($user)){
$field = 'id';
}elseif(!filter_var($user, FILTER_VALIDATE_EMAIL) === false){
$field = 'email';
}else{*/
$field = 'username';
//}

So this function assigns $field = 'username' without a doubt. And the behavior is the same, can't log in with any user.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)