Integrate WordPress login with Nextcloud
Autenticate at Nextcloud using username and password of WordPress.
occ config:system:set wordpress_dsn --value "mysql:host=myserverhostname;port=3306;dbname=woocommerce;user=root;password=root"Replace the values by your database settings.
The database user only needs SELECT on the tables read by the queries
(wp_users and wp_wc_orders with the default ones) and UPDATE on
wp_users.user_pass:
GRANT SELECT ON woocommerce.wp_users TO 'nextcloud'@'%';
GRANT SELECT ON woocommerce.wp_wc_orders TO 'nextcloud'@'%';
GRANT UPDATE (user_pass) ON woocommerce.wp_users TO 'nextcloud'@'%';Only accounts linked to a WordPress user can log in with the WordPress
password, and only their password changes are written back to WordPress. The
WordPress user is the one whose user_login is exactly the account uid. See
Linking existing accounts.
While logged in, only administrators and delegated administrators can create an account whose uid is a WordPress login.
You can override default SQL queries using the wordpress_queries system key,
following the same idea used by user_backend_sql_raw.
Supported query keys:
get_wordpress_userget_disabled_usersset_wordpress_password
Example:
occ config:system:set wordpress_queries --type json --value '{"get_wordpress_user":"SELECT user_pass AS password, user_login AS uid, display_name AS displayname, 1 AS enabled FROM wp_users WHERE user_login = :username","get_disabled_users":"SELECT user_login AS uid FROM wp_users WHERE user_login LIKE :search","set_wordpress_password":"UPDATE wp_users SET user_pass = :hash WHERE user_login = :username"}'The backend expects these named parameters:
:usernamefor user lookup and password updates:searchfor disabled-user listing:hashfor password updates
An account is linked to WordPress by the user preference wordpress_login of
the app wordpress_login_backend, holding the account uid. Admin Group Manager
records it when it creates the account that owns a group.
When upgrading from a version that did not require the link, deploy in this order, otherwise the existing customers cannot log in:
- a version of Admin Group Manager that records the link;
- this app, then run the command below to link the existing accounts.
To link the accounts created before that, run:
occ wordpress-login-backend:link-users --dry-run
occ wordpress-login-backend:link-usersThe command links each account that is sub-admin of the group with the same id
as its uid and has a WordPress user with exactly that login. Members of the
groups are never linked and are listed as skipped. With --dry-run it only
lists the accounts.
If you need help using this app, or if you want custom development, priority support, or an enterprise support plan, please contact us.
- Community support and bug reports: https://github.com/libresign/wordpress_login_backend/issues
- Professional support and customizations: contact@librecode.coop
LibreSign-related enterprise support can also be discussed through the same contact channel.