262 Commits

Author SHA1 Message Date
Linty
e0a2a0ba2b fixes #2449 enhance password reset flow with verification and lockout
Added email notification for successful password reset, improved verification code handling, and implemented account lockout after too many failed attempts. Introduced new language strings for user feedback and security messages. Refactored password reset logic to better handle guest/generic users and API key recommendations.
2025-11-17 21:43:14 +01:00
Linty
c43c3696e0 issue #2440 clear fake user cache on successful login
Added a call to clear_fake_user_cache() in pwg_login to ensure the fake user cache is reset after a successful login. Also introduced the clear_fake_user_cache() function for this purpose.
2025-11-13 15:44:00 +01:00
Linty
0f494baa0c fixes #2440 enhance login security and user activity display
Improves login security by:
- implementing constant-time authentication to reduce timing attacks
- refactoring user lookup into find_user_by_username_or_email() for username or email login
- introducing a fake user to keep password verification time consistent
- adding a finalize_login hook so plugins can control the authentication flow (2FA, rate limiting, etc.)

Also updates user activity JS to:
- better display action details
- properly handle user lists (login/logout with multiple users)
2025-11-13 14:05:35 +01:00
plegall
a04c93cf76 fixes #2092 redesigned handling of return to gallery after photo edit
* instead of using the provided cat_id in the URL parameters, registers the "context" of the last 10 photos viewed. Be it an album, a search, a tag...
* maybe not the cleanest way to do it (because we do not rebuild the url string) but simple and straightforward
2025-11-03 21:49:23 +01:00
Linty
99bb370b98 fixes #2425 unescape API key name before returning
Added a call to stripslashes for the 'apikey_name' field to ensure it is unescaped before being returned. This improves display consistency for API key names containing escaped characters.
2025-10-29 12:03:43 +01:00
Linty
d6a1cf0466 fixes #2424 remove connection by header from API key validation
Simplifies the API key validation in auth_key_login by removing the requirement for connection_by_header. Now, API keys matching the pattern are accepted regardless of the connection source.
2025-10-29 11:49:19 +01:00
Linty
9ac99be1de fixes GHSA-9986-w7jf-33f6 and fixes GHSA-9986-w7jf-33f6
* Introduces a verification code step before generating password reset links.
* New configuration "password_reset_code_duration".
* Adds Base32, TOTP and PHPQRCode classes .
* New section is required in password.tpl: code verification won't work on themes not updated yet.
* 5 new language strings were added.
2025-10-17 15:38:21 +02:00
Linty
dbec498287 fixes #2404 notify users of impending API key expiration
Adds logic to detect when an API key is about to expire and sends a notification email to the user if the key expires within 7 days and no recent notification was sent. Introduces a new 'last_notified_on' column to the user_auth_keys table to track notification timing.
2025-09-04 17:21:53 +02:00
Linty
eec9a919a5 issue #2355 enforce ui context for API key management
...and improve profile JS. Replaces can_manage_api_key() with connected_with_pwg_ui() to ensure API key management is only allowed from UI logins, and sets 'connected_with' in session during auto-login. Refactors profile.js to respect canUpdatePreferences and canUpdatePassword, moves user state initialization to template, and improves preference reset/default logic. Also adjusts script loading and minor UI details in profile.tpl.
2025-07-07 08:58:27 +02:00
Linty
ae740ba3af fixes #2355 implement API key management system
- Added API key get, creation, editing, and revocation methods.

- Updated the profile template to include API key management features.

- Updated the database schema to support the new API key system, including additional fields for key management.

- Added client-side JavaScript functionality to handle API key operations and display responses.

- Update tools/htm.ws with the new way to authenticate.

- Restriction of certain api methods when used with an api key

- Backward compatibility with older apps
2025-06-09 20:35:57 +02:00
Linty
7f850c2938 issue #2354 update pwg.users.setInfo
and add pwg.users.setMyInfo method
2025-05-05 20:24:05 +02:00
HWFord
f88472fa9c fixes #2345 create piwigo standard pages
create new theme standard pages with tpl, css, js and images
update backend to handle pages
add config use_standard_pages
on update set config to false, on install set config to true
add standard pages to no be ingored in git
2025-03-18 16:46:41 +01:00
plegall
33b57be509 fixes #2334 wait user_cache rebuild for 20 seconds instead of 10 2025-03-01 12:24:13 +01:00
plegall
5eacda0d76 fixes #2333 avoid deadlock while waiting for user_cache rebuild 2025-03-01 12:04:41 +01:00
Linty
cc675b712b fixes #2327 standardize password masking length in emails 2025-02-24 13:48:38 +01:00
plegall
28a676b2d9 fixes #2311 single instance of user_cache generation 2025-01-10 10:59:56 +01:00
Linty
8f721fcb8b fixes #2303 replace the password in clear text with asterisks 2025-01-06 16:21:41 +01:00
Linty
6e45a8f426 fixes #2281 use template for reset/activation mail
and change is_first_connection to has_already_logged_in for better naming
2024-11-20 21:06:02 +01:00
Linty
f6a3d0749f fixes #2281 rename function for better clarity
first_connexion to is_first_connection
2024-11-20 18:09:02 +01:00
Linty
34296598d4 fixes #2281 add two default conf for reset and activation link
When a password activation or reset link is generated, the link expiry time is now defined in two conf: $conf[’password_reset_duration‘] with a default time of one hour and $conf[’password_activation_duration‘] with a default time of 72 hours.
2024-11-20 17:09:26 +01:00
Linty
431cb4b7b4 fixes #1152 unset last_visit columns from default_user 2024-11-19 17:17:01 +01:00
plegall
3ee277f8e0 fixes #171 ability to filter user list on a specific user 2024-08-21 12:11:27 +02:00
Linty
c8d7503d4e related to #2165 new add user popin
- add field for add user
- in the `pwg.users.add` method, the params `send_password_by_mail` does nothing anymore. Because we no longer want to send passwords in clear text.
- in the `pwg.users.add` add a new `auto_password` parameter to generate a random password when a user is created
- use this parameter (`auto_password`) in user_list.js
- change mail content et password page on first login
2024-06-28 18:56:28 +02:00
Linty
27cd5cde9e related to #2158 update user and guest pop in
- Implementation of a new modal for modifying a user or guest
- Addition of a function to allow plugins to add a tab to the new user modal
- Fix bug: "badger-number" is updated when a user is added or deleted
- Fix bug: When the user who is editing has permissions to delete the user he is modifying, the delete icon is now displayed correctly
- Added a new api method for modifying the main user and generating a link to reset a password
- Passed $conf[‘webmaster_id’] in database configuration
2024-05-31 18:12:52 +02:00
plegall
4b33001c15 fixes #1902 ability to set a specific group to notify user registrations 2023-04-22 17:21:29 +02:00
Matthieu Leproux
32ea1aef53 fixed #1802 fixed double escape for user creation, album creation and comments 2022-11-22 16:01:43 +01:00
Matthieu Leproux
f7e44cc14e related to #1767 changed the way 9d5cba0 is done 2022-10-26 12:53:35 +02:00
Matthieu Leproux
9d5cba0096 fix #1767 Solved php warning and user creation works as is should 2022-10-25 10:05:23 +02:00
Arnie97
9b22164adc fixes #680, #875 and #1028: improve detection for browser preferred languages 2022-09-21 16:43:05 +02:00
plegall
c2f8238e16 issue #1640 user preferences 2022-03-31 18:16:23 +02:00
plegall
444c653878 fixes #1368 user with "guest" status get refused connection 2021-05-05 17:03:19 +02:00
plegall
7d7943b3ed fixes #1275 delete password reset key when email address is changed 2020-12-22 15:04:30 +01:00
Maxime BOURMAUD
32ff00caec Feature#765 now it's possible to login with your email address (#770)
First we check for the username, if not found we check among email addresses.
2020-09-30 10:51:29 +02:00
plegall
40182f7774 fixes #1120 check installed theme on its identifier (=directory name), not on its display name 2020-04-30 11:32:52 +02:00
Sam
10962c9208 Fix version comparison for session ID regen (#1178)
session_regenerate_id : as planned back in 2016, remove PHP version check entirely.

... and let's see if it still is a problem on recent PHP versions.
2020-04-23 12:51:35 +02:00
Rasmus Lerdorf
f62ee77852 Fix count() warning
In PHP 7.2 and later you will get a warning if you call count() on null. So either initialize $errors to an empty array here, or use empty() to check it as I have done here.
2019-12-16 10:50:14 +01:00
Sam Wilson
7b6912ba98 Use default theme if loaded one is not found
When loading a user's theme, make sure it's installed. Also, when
determining the default theme, account for the situation in which
zero themes are installed (and use 'default' then).

Refs #1061
2019-08-14 12:18:45 +02:00
plegall
c1eecab364 fixes #996 escape word "groups" in SQL queries, new reserved word with MySQL 8 2019-06-28 18:07:53 +02:00
plegall
fc193f7474 issue #830 simplify PHP files header, remove copyright/license info 2019-06-04 17:13:51 +02:00
plegall
940d1d2e8c issue #552
* many more admin actions are logged into activity table
* use the activity.details as an associative array (serialized in database)
2019-04-01 16:19:09 +02:00
Teatek
beec234478 fixes #958 : protect fields before copying properties from default user to new user 2019-01-27 16:52:15 +01:00
plegall
a9fa61adfe Merge branch '2.8' 2016-10-20 10:43:41 +02:00
plegall
25d2305839 fixes #542, do not always use browser language on register 2016-10-20 10:14:28 +02:00
plegall
4560e2d824 fixes #478, add new column user_infos.last_visit
This will speed up user edit popin opening, by avoiding to search in history for the last user visit.

The column user_infos.last_visit_from_history true/false says if the last_visit has already been search in history (to avoid making it twice). I could have implemented the search of last_visit for all users in the migration task 149 but in case of many users and long history, it would have taken years to execute...
2016-05-31 16:00:03 +02:00
plegall
c451470ad4 typo fixed 2016-02-12 20:22:20 +01:00
plegall
fbd90fa460 fixes #414, deactivate auth keys on password change 2016-02-12 20:20:12 +01:00
plg
08fe998dd1 session_regenerate_id() still fails with PHP 7.0.3
fix indentation
2016-02-10 15:19:40 +01:00
Nicolas
0909717c37 if php version is less than 7.0.3 and session_id exists do nothing 2016-02-10 12:37:12 +01:00
plegall
2fcf276811 fixes #413, force log in with auth key user 2016-02-01 10:05:33 +01:00
plegall
a12425629e fixes #412, warn visitor if auth key no longer valid 2016-01-29 12:44:38 +01:00