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
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/printthread.php(287) : eval()'d code 2 errorHandler->error
/printthread.php 287 eval
/printthread.php 117 printthread_multipage



UserSpice
Can not signin with username is number - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28)
+--- Forum: Off-topic Discussions (https://userspice.com/forums/forumdisplay.php?fid=10)
+--- Thread: Can not signin with username is number (/showthread.php?tid=327)

Pages: 1 2 3


Can not signin with username is number - tandat102 - 10-27-2016

If the username is number example: (123456), I can not login.

help me! thanks


Can not signin with username is number - mudmin - 10-28-2016

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.


Can not signin with username is number - mudmin - 10-28-2016

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.


Can not signin with username is number - tandat102 - 11-01-2016

Thanks you for sppport


Can not signin with username is number - plb - 11-20-2016

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)


Can not signin with username is number - mudmin - 11-20-2016

Good call on that one.


Can not signin with username is number - hernancorteshc@hotmail.com - 06-15-2017

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!!


Can not signin with username is number - mudmin - 06-15-2017

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.


Can not signin with username is number - hernancorteshc@hotmail.com - 06-15-2017

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!


Can not signin with username is number - hernancorteshc@hotmail.com - 06-15-2017

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.