LinkStackOrg / LinkStack

LinkStack - the ultimate solution for creating a personalized & professional profile page. Showcase all your important links in one place, forget the limitation of one link on social media. Set up your personal site on your own server with just a few clicks.
https://linkstack.org
GNU Affero General Public License v3.0
2.3k stars 235 forks source link

Can't change password of admin #18

Closed praul closed 2 years ago

praul commented 2 years ago

Hi there and thanks for this software. Unfortunately, I cannot change passwords of admin (or maybe other users too). Update profile works when leaving password field empty. If I enter any password there, I get:

Illuminate\Database\QueryException SQLSTATE[23000]: Integrity constraint violation: 19 CHECK constraint failed: users (SQL: update "users" set "name" = admin, "email" = admin@admin.com, "password" = $2y$10$RM6YyZ7yNSlbm3uFYeU7XuZT3GpAkavsVBVzZA78MGYZjjv8VrdiS, "littlelink_name" = admin, "littlelink_description" = admin page, "role" = Admin, "updated_at" = 2022-03-26 08:41:53 where "id" = 1)

image

If you need more debug info, let me know.

Edit: It seems, my whole setup is broken. I'm gonna try to reinstall

JulianPrieber commented 2 years ago

Thank you for using LittleLink Custom.

This might be an error still carried over from LittleLink Admin.

Can you write to the database at all (i.e. register new users or add links)? This error appears when inserting/updating a null value in the database. I couldn't reproduce this error on Apache (Windows) yet, but I've encountered a similar issue on Linux before.

I could work around this issue by updating every field (e.g. name, password, email... etc.) maybe this works for you as well.

praul commented 2 years ago

Hi, no - unfortunately not. I can add links, but I cannot edit users, even with all fields filled.

Edit: Nope, can't do it. Tried php 7.4, 8.0, 8.1, served by nginx, fpm apache, apache fast-cgi and older release. I cannot edit users. They can register though. So in short: The edit user function is broken for me.

praul commented 2 years ago

Update 2: It somewhat works when I set database to mysql. I converted the sqlite file and imported it into mysql, since the migrations button did not work.

Now, when I change admin password, I somehow lose admin capabilities. I can login, and the user role is admin, but I don't have access to the admin settings anymore.

I guess the reason is: User role gets saved as "Admin" instead of "admin".

JulianPrieber commented 2 years ago

You might be on to something here. I have noticed before that you couldn't change the role of a user from the Admin Panel, but I haven't worked on fixing the existing system yet because I'm experimenting with replacing this system entirely. The database seeder, auth, saving and access system was written by Khashayar for LittleLink Admin and you can't change user roles there either. This bug has existed for a long time.

Now, if you were to write, the user role as "Admin" instead of "admin" to the database the value would get rejected, and no change would be made effectively. This would explain the displayed behavior, but I'm not sure if this is really what's happening. I've looked into the auth section that writes to the database and I don't think this is what's causing the issue, but I will look further into this.

Now if you want to use MySQL instead of SQLite you need to run the seeder and migrations manually. You probably want to empty your database again and run the following commands from your LittleLink Custom installation's folder:

php artisan migrate
php artisan db:seed 
php artisan db:seed --class="AdminSeeder"
php artisan db:seed --class="PageSeeder"
php artisan db:seed --class="ButtonSeeder"
JulianPrieber commented 2 years ago

Okay, after some testing I was able to change the role of a user, but I could only do it if I changed every value in the 'Edit User' section including the password.

JulianPrieber commented 2 years ago

Just released Version v2.5.3 which implements a fix for the 'not saving values bug' in the 'Edit User' section.

On the condition that your problem has been resolved with this, you can go ahead and close the issue. If you need anything else, I'm here to help.

If you feel like this project could offer you something, feel free to star the repo, as this really helps a lot.

praul commented 2 years ago

Thanks, I'm gonna try it out and report back

praul commented 2 years ago

Seems to be working fine. Thanks!