News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

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

Ulibka

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.

https://www.simplemachines.org/community/index.php?topic=545232.msg3871105#msg3871105
https://www.simplemachines.org/community/index.php?topic=542801.msg3856746#msg3856746
https://www.simplemachines.org/community/index.php?topic=571384.20

shawnb61 propose to correct  script.js - I'm do it, but no effects.
https://www.simplemachines.org/community/index.php?topic=571082.msg4042818#msg4042818

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:
https://woodtools.site/index.php
login:
Иван456
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?

Deaks

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 https://woodtools.site/index.php?action=login or just when they use the login at the top?
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

Ulibka

SMF 2.017
I can solve this problem.

1. First apply this patch by shawnb61 to script.js:
https://www.simplemachines.org/community/index.php?topic=571082.msg4042818#msg4042818

2. Some problem was in theme.
I'm select Japanese Red [Responsive] theme by solarhythmia :
https://custom.simplemachines.org/themes/index.php?lemma=2867

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!

Deaks

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

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

Advertisement: