stefanpejcic / OpenPanel

OpenPanel is a powerful and flexible web hosting control panel for Linux systems.
https://openpanel.com
MIT License
162 stars 23 forks source link

Password reset for openpanel users does not end all active sessions on that user #66

Open radovanjecmenica opened 6 months ago

radovanjecmenica commented 6 months ago

OpenPanel version(s) affected

0.1.4

Description

Password reset for openpanel users does not end all active sessions on that user

How to reproduce

Log to openpanel user. use cli command: opencli user-password username password After refresh page where you are logged in

Possible Solution

No response

Additional Context

No response

stefanpejcic commented 2 weeks ago

done in 0.2.9

need prettier error messages.

stefanpejcic commented 1 week ago

Reopwn as a reminder to update scripts

stefanpejcic commented 1 week ago
[root@demo ~]# bash -x /usr/local/admin/scripts/user/password  stefan Sak4_N6_Cim7
+ '[' 2 -lt 2 ']'
+ username=stefan
+ new_password=Sak4_N6_Cim7
+ ssh_flag=false
+ random_flag=false
+ DEBUG=false
+ for arg in "$@"
+ case $arg in
+ for arg in "$@"
+ case $arg in
+ source /usr/local/admin/scripts/db.sh
++ config_files=("/etc/my.cnf" "/etc/openpanel/mysql/db.cnf" "/usr/local/admin/db.cnf")
++ check_config_file
++ for config_file in "${config_files[@]}"
++ '[' -f /etc/my.cnf ']'
++ return 0
++ mysql_database=panel
+ '[' Sak4_N6_Cim7 == random ']'
++ python3 -c 'from werkzeug.security import generate_password_hash; print(generate_password_hash('\''Sak4_N6_Cim7'\''))'
+ hashed_password='scrypt:32768:8:1$W1CdYzxxVFLfMvtJ$3691f1ed58a582e9aadfc2d682f54738cb088d956c9bf14ffcb52e4382be2dd63c06235fe8dfa8cc5cc1d06c0547954a9f66a2412ec4267c99588acec3ab9beb'
+ change_user_password='UPDATE users SET password='\''scrypt:32768:8:1$W1CdYzxxVFLfMvtJ$3691f1ed58a582e9aadfc2d682f54738cb088d956c9bf14ffcb52e4382be2dd63c06235fe8dfa8cc5cc1d06c0547954a9f66a2412ec4267c99588acec3ab9beb'\'' WHERE username='\''stefan'\'';'
+ mysql --defaults-extra-file=/etc/my.cnf -D panel -e 'UPDATE users SET password='\''scrypt:32768:8:1$W1CdYzxxVFLfMvtJ$3691f1ed58a582e9aadfc2d682f54738cb088d956c9bf14ffcb52e4382be2dd63c06235fe8dfa8cc5cc1d06c0547954a9f66a2412ec4267c99588acec3ab9beb'\'' WHERE username='\''stefan'\'';'
+ '[' 0 -eq 0 ']'
+ detektuj_id_stari='SELECT id FROM users WHERE username='\''stefan'\'';'
++ mysql --defaults-extra-file=/etc/my.cnf -D panel -Bse 'SELECT id FROM users WHERE username='\''stefan'\'';'
+ stari_id=1
+ '[' -z 1 ']'
+ zameni_za_sve_domene='UPDATE domains SET user_id=(SELECT MAX(id) + 1 FROM users) WHERE user_id='\''1'\'';'
+ mysql --defaults-extra-file=/etc/my.cnf -D panel -e 'UPDATE domains SET user_id=(SELECT MAX(id) + 1 FROM users) WHERE user_id='\''1'\'';'
ERROR 1452 (23000) at line 1: Cannot add or update a child row: a foreign key constraint fails (`panel`.`domains`, CONSTRAINT `domains_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`))
+ '[' 1 -eq 0 ']'
+ echo 'Error: Updating domains table failed.'
Error: Updating domains table failed.
+ exit 1