Topic: Updating mailbox.passwordlastchange automaticaly
==== Required information ====
- iRedMail version (check /etc/iredmail-release):
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
======== Required information ====
- iRedMail version (check /etc/iredmail-release):
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
======== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.5-1
- Linux/BSD distribution name and version: Ubuntu
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
Hi!
When using SQL the vmail.mailbox table contains a 'passwordlastchange' column, that keeps the last time the user's password was changed.
I've noticed that only iRedAdmin was actually updating this field and my Web frontend (SoGO) did not even have access to this column by default.
I created a trigger that seems to be working and updating the 'passwordlastchange' field automatically when anything changes the 'password' field with an UPDATE statement to the vmail.mailbox table:
delimiter //
create TRIGGER PasswordChanged BEFORE UPDATE ON mailbox
FOR EACH ROW
BEGIN
IF NEW.password <> OLD.password THEN
SET NEW.passwordlastchange=NOW();
END IF;
END;//
delimiter ;
Hope this is useful and can be incorporated in the the default database schema in an upcoming release
Regards,
Alex
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.