Blocked Admin

Martin68

Well-known member
Hello there,

I be made a bad mistake, tried to check the possibility to change passwords of users by a user who belongs to the group „managers“, therefore I changed my personal account - normally admin - to this group and revealed that I could not see the admin section.

Idiotically I entered a false password for the admin account , so I am out of my database 🤪.

Can I change my personal unerfreulich by sql?

Kind regards

Martin
 

eugenio

Administrator
Staff member
Hello,
you can create another dadabik app just for the purpose of adding a new user with a new, temporary. password of your choice. Then you can copy such password (encrypted) from the database of the new app and replace your password in the database of the old app.
You should now be able to login in the old app and finally change your password with the "edit your account link".

Best,
 

Martin68

Well-known member
Thanks Eugenio,

i heve resurrected my admin status by changing the group my account ist belonging at mariadb. Problem seemed to be solved.

But now I have another problem: I couldn't change any password any more - cryptic doesn't transfer hash to the input-field in user-table-input field any more ... could it be a bug?

Kind regards

Martin
 

eugenio

Administrator
Staff member
Hello,
I am not aware of any bugs related to the password registration, which version are you using and have you changed anything in the code?
 

Martin68

Well-known member
Good morning Eugenio,

i have implemented a php-function which checks the password for security reasons; seems to work, but I will check this, thanks for the hint.

Kind regards

Martin
 

Martin68

Well-known member
Hi Eugenio,

seems to be a problem with my validate_password-function.

I overturned the check, returned true and could change password. Has been working as I ve been implementing it :)

Will have a look at the code and hopefully find the bug.

Kind regards

Martin

ps. perhaps has anyone an idea where I ve been going wrong...

function validate_password($password)
{
if (preg_match("#.*^(?=.{8,20})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\W).*$#", $password))
return true;
else
return false;
}
 

Martin68

Well-known member
Found the problem: by updating to the latest version the German translation of the error message for "password_not_valid " seems to be deleted from /include/languages/German.php. reinserted the text and it works! Perhaps a fallback to English error-message would be helpful.

Kind regards

Martin
 

eugenio

Administrator
Staff member
If you want to customize a language, you should use a german_custom.php file, see https://dadabik.com/index.php?function=show_documentation#language
this prevents overriding.

Best,
 

Martin68

Well-known member
Hi Eugenio,

i am sorry, I tried tu use a custom language file and didn't find the correct syntax.

I ve read the explanation in English_custom.php, which contains a PHP-Beginning tag and some comments, but no end of php-tag.

I don't know how Dadabik concats both language-files so I tried to enter the following:

"password_not_valid" => 'Passwort entspricht den definierten Mindestanforderungen nicht!',

below the comments with no other changes. Afterwards the Dadabik-Applikation doesn't start any more. Seems to be necessary to end custom-php-file correctly. But I don't know enough php to have an idea how you put the array with language-specific text together with the entries in the German_custom.php-file. Could you perhaps give an example?

Kind regards

Martin
 

eugenio

Administrator
Staff member
Hello,
not having the end PHP tag is fine.

The only thing you have to add to the file in your case is:

$normal_messages_ar['password_not_valid'] = 'Passwort entspricht den definierten Mindestanforderungen nicht!';

Best,
 

Martin68

Well-known member
Good Morning Eugenio,

sorry for asking you again: I have added the line in german_custom.php and it seems to work, at least the database could start.

I changed the Message-text for checking which version - the one I have left in German.php or the one I have added in german_custom.php - is used an I found that the program again uses the definition in German.php.

Deleting the line with the Massage in German.php leads to the problems I have had at the first time: Changing the Password is not possible cause the systems "hangs" after clicking on "encrypt".

Any idea where I am going wrong.

Kind regards

Martin
 

eugenio

Administrator
Staff member
Hello,
German.php must remain untouched.
Sorry it's $error_messages_ar['password_not_valid'] and not $normal_messages_ar['password_not_valid'], that's why it's not working.
Always check which is the array the message is using in german.php (error_messages_ar, normal_messages_ar, ....) and use the same in german_custom.

Best,
 
Top