SMF 2.017 user with UTF8 2 - bytes coding need to login twice

Started by Ulibka, June 05, 2020, 04:57:54 PM

Previous topic - Next topic


I have SMF 2.017
I have login problem if user name contain UTF-8 russian letters (2-byte).
If user have russian letters in login - it need to login twice.
On first login user see : invalid password.
Second attempt - login ok.

I'm see several post about this.

shawnb61 propose to correct  script.js - I'm do it, but no effects.

I'm try default curve theme - the same effect.
The problem contain in local openserver (no https) and on lunix server.

you can try it byself on test site:
password: 1234

I'm run upgrade.php - it runs ok.
Forum coding is UTF8
all database table have UTF8 coding

Curve theme and Japanes theme have this string in login form:
<input type="hidden" name="hash_passwrd" value="" /><input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />

I'm don't use .htaccess file in local and lunix server

In settiings.php I have:
$db_character_set = 'utf8';

Server Cookies and Sessions have this configuration:

Can you please advice me any other steps?


Ulibka, did you get this sorted? if not can I ask is it all users that have that issue if they use russian characters or just some? 

Also does it happen on or just when they use the login at the top?
Former SMF Project Manager
Former SMF Customizer


SMF 2.017
I can solve this problem.

1. First apply this patch by shawnb61 to script.js:

2. Some problem was in theme.
I'm select Japanese Red [Responsive] theme by solarhythmia :

After compare it with default theme I'm found some difference in login form.

To Fix:

find in index.template.php of Japanes theme:
var smf_charset = "utf-8";', $context['show_pm_popup'] ? '

replace to:
var smf_charset = "', $context['character_set'], '";', $context['show_pm_popup'] ? '

3. Some problem in coding.
I do upgrade from smf 2.011 and manualy convert smf_members to UTF-8. Previous coding was cp-1251

After conversion all user with non-english letters must recover password.

But SMF have internal mechanism to save old password.
Yoy need to do two queries:

INSERT INTO smf_settings (variable, value) VALUES ('global_character_set', 'UTF-8')
INSERT INTO smf_settings (variable, value) VALUES ('previousCharacterSet', 'CP1251')

And when user with non-english letters try to login at first time - it wirite password one time - and SMF automatically convert old has to new hash at write to User: invalid password
After User write password again and all is OK!


glad you have it sorted :)

Also thank you for the steps you took these will hopefully help other users who face a similar issue.
Former SMF Project Manager
Former SMF Customizer