diff --git a/sql/swad.sql b/sql/swad.sql index 4aecffdb3..d1968aaee 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -1141,24 +1141,6 @@ CREATE TABLE IF NOT EXISTS ntf_notifications ( INDEX(ToUsrCod), INDEX(TimeNotif)); -- --- Table pending_emails: stores the emails pending of confirmation --- -CREATE TABLE IF NOT EXISTS pending_emails ( - UsrCod INT NOT NULL, - E_mail VARCHAR(255) COLLATE latin1_general_ci NOT NULL, - MailKey CHAR(43) COLLATE latin1_bin NOT NULL, - DateAndTime DATETIME NOT NULL, - INDEX(UsrCod), - UNIQUE INDEX(MailKey)); --- --- Table pending_passwd: stores the passwords pending of activation, sent by e-mail when a user who have forgotten his/her password request a new one --- -CREATE TABLE IF NOT EXISTS pending_passwd ( - UsrCod INT NOT NULL, - PendingPassword CHAR(86) COLLATE latin1_bin NOT NULL, - DateAndTime DATETIME NOT NULL, - PRIMARY KEY(UsrCod)); --- -- Table pho_clicks_without_photo: stores the number of clicks that remains to each user before being required to submit his/her photo -- CREATE TABLE IF NOT EXISTS pho_clicks_without_photo ( @@ -1737,6 +1719,24 @@ CREATE TABLE IF NOT EXISTS usr_nicknames ( UNIQUE INDEX(UsrCod,Nickname), UNIQUE INDEX(Nickname)); -- +-- Table usr_pending_emails: stores the emails pending of confirmation +-- +CREATE TABLE IF NOT EXISTS usr_pending_emails ( + UsrCod INT NOT NULL, + E_mail VARCHAR(255) COLLATE latin1_general_ci NOT NULL, + MailKey CHAR(43) COLLATE latin1_bin NOT NULL, + DateAndTime DATETIME NOT NULL, + INDEX(UsrCod), + UNIQUE INDEX(MailKey)); +-- +-- Table usr_pending_passwd: stores the passwords pending of activation, sent by e-mail when a user who have forgotten his/her password request a new one +-- +CREATE TABLE IF NOT EXISTS usr_pending_passwd ( + UsrCod INT NOT NULL, + PendingPassword CHAR(86) COLLATE latin1_bin NOT NULL, + DateAndTime DATETIME NOT NULL, + PRIMARY KEY(UsrCod)); +-- -- Table usr_report: stores users' usage reports -- CREATE TABLE IF NOT EXISTS usr_report ( diff --git a/swad_account.c b/swad_account.c index 29f222bfd..3f4252882 100644 --- a/swad_account.c +++ b/swad_account.c @@ -1167,36 +1167,43 @@ static void Acc_RemoveUsr (struct UsrData *UsrDat) { /***** Remove user's webs / social networks *****/ DB_QueryDELETE ("can not remove user's webs / social networks", - "DELETE FROM usr_webs WHERE UsrCod=%ld", + "DELETE FROM usr_webs" + " WHERE UsrCod=%ld", UsrDat->UsrCod); /***** Remove user's nicknames *****/ DB_QueryDELETE ("can not remove user's nicknames", - "DELETE FROM usr_nicknames WHERE UsrCod=%ld", + "DELETE FROM usr_nicknames" + " WHERE UsrCod=%ld", UsrDat->UsrCod); /***** Remove user's emails *****/ DB_QueryDELETE ("can not remove pending user's emails", - "DELETE FROM pending_emails WHERE UsrCod=%ld", + "DELETE FROM usr_pending_emails" + " WHERE UsrCod=%ld", UsrDat->UsrCod); DB_QueryDELETE ("can not remove user's emails", - "DELETE FROM usr_emails WHERE UsrCod=%ld", + "DELETE FROM usr_emails" + " WHERE UsrCod=%ld", UsrDat->UsrCod); /***** Remove user's IDs *****/ DB_QueryDELETE ("can not remove user's IDs", - "DELETE FROM usr_IDs WHERE UsrCod=%ld", + "DELETE FROM usr_IDs" + " WHERE UsrCod=%ld", UsrDat->UsrCod); /***** Remove user's last data *****/ DB_QueryDELETE ("can not remove user's last data", - "DELETE FROM usr_last WHERE UsrCod=%ld", + "DELETE FROM usr_last" + " WHERE UsrCod=%ld", UsrDat->UsrCod); /***** Remove user's data *****/ DB_QueryDELETE ("can not remove user's data", - "DELETE FROM usr_data WHERE UsrCod=%ld", + "DELETE FROM usr_data" + " WHERE UsrCod=%ld", UsrDat->UsrCod); } diff --git a/swad_changelog.h b/swad_changelog.h index c778212cd..d3e1d0a0f 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -600,17 +600,23 @@ TODO: Salvador Romero Cort TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria. */ -#define Log_PLATFORM_VERSION "SWAD 20.51.21 (2021-03-19)" +#define Log_PLATFORM_VERSION "SWAD 20.51.22 (2021-03-19)" #define CSS_FILE "swad20.45.css" #define JS_FILE "swad20.6.2.js" /* TODO: Rename CENTRE to CENTER in help wiki. TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams - Version 20.51.21: Mar 19, 2021 Notices database tables renamed. (308101 lines) + Version 20.51.22: Mar 19, 2021 Rooms database tables renamed. (308117 lines) 2 changes necessary in database: +RENAME TABLE pending_emails TO usr_pending_emails; +RENAME TABLE pending_passwd TO usr_pending_passwd; + + Version 20.51.21: Mar 19, 2021 Notices database tables renamed. (308101 lines) + 3 changes necessary in database: RENAME TABLE notices TO not_notices; RENAME TABLE notices_deleted TO not_deleted; +RENAME TABLE links TO lnk_links; Version 20.51.20: Mar 19, 2021 Rooms database tables renamed. (308069 lines) 2 changes necessary in database: diff --git a/swad_database.c b/swad_database.c index f8cb0fec7..82c87d361 100644 --- a/swad_database.c +++ b/swad_database.c @@ -2377,45 +2377,6 @@ mysql> DESCRIBE ntf_notifications; "INDEX(CrsCod)," "INDEX(TimeNotif))"); - /***** Table pending_emails *****/ -/* -mysql> DESCRIBE pending_emails; -+-------------+--------------+------+-----+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+-------------+--------------+------+-----+---------+-------+ -| UsrCod | int(11) | NO | MUL | NULL | | -| E_mail | varchar(255) | NO | | NULL | | -| MailKey | char(43) | NO | PRI | NULL | | -| DateAndTime | datetime | NO | | NULL | | -+-------------+--------------+------+-----+---------+-------+ -4 rows in set (0,00 sec) -*/ - DB_CreateTable ("CREATE TABLE IF NOT EXISTS pending_emails (" - "UsrCod INT NOT NULL," - "E_mail VARCHAR(255) COLLATE latin1_general_ci NOT NULL," // Cns_MAX_CHARS_EMAIL_ADDRESS - "MailKey CHAR(43) COLLATE latin1_bin NOT NULL," // Mai_LENGTH_EMAIL_CONFIRM_KEY - "DateAndTime DATETIME NOT NULL," - "INDEX(UsrCod)," - "UNIQUE INDEX(MailKey))"); - - /***** Table pending_passwd *****/ -/* -mysql> DESCRIBE pending_passwd; -+-----------------+----------+------+-----+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+-----------------+----------+------+-----+---------+-------+ -| UsrCod | int(11) | NO | PRI | NULL | | -| PendingPassword | char(86) | NO | | NULL | | -| DateAndTime | datetime | NO | | NULL | | -+-----------------+----------+------+-----+---------+-------+ -3 rows in set (0.00 sec) -*/ - DB_CreateTable ("CREATE TABLE IF NOT EXISTS pending_passwd (" - "UsrCod INT NOT NULL," - "PendingPassword CHAR(86) COLLATE latin1_bin NOT NULL," // Pwd_BYTES_ENCRYPTED_PASSWORD - "DateAndTime DATETIME NOT NULL," - "PRIMARY KEY (UsrCod))"); - /***** Table pho_clicks_without_photo *****/ /* mysql> DESCRIBE pho_clicks_without_photo; @@ -3631,6 +3592,45 @@ mysql> DESCRIBE usr_nicknames; "UNIQUE INDEX(UsrCod,Nickname)," "UNIQUE INDEX(Nickname))"); + /***** Table usr_pending_emails *****/ +/* +mysql> DESCRIBE usr_pending_emails; ++-------------+--------------+------+-----+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++-------------+--------------+------+-----+---------+-------+ +| UsrCod | int(11) | NO | MUL | NULL | | +| E_mail | varchar(255) | NO | | NULL | | +| MailKey | char(43) | NO | PRI | NULL | | +| DateAndTime | datetime | NO | | NULL | | ++-------------+--------------+------+-----+---------+-------+ +4 rows in set (0,00 sec) +*/ + DB_CreateTable ("CREATE TABLE IF NOT EXISTS usr_pending_emails (" + "UsrCod INT NOT NULL," + "E_mail VARCHAR(255) COLLATE latin1_general_ci NOT NULL," // Cns_MAX_CHARS_EMAIL_ADDRESS + "MailKey CHAR(43) COLLATE latin1_bin NOT NULL," // Mai_LENGTH_EMAIL_CONFIRM_KEY + "DateAndTime DATETIME NOT NULL," + "INDEX(UsrCod)," + "UNIQUE INDEX(MailKey))"); + + /***** Table usr_pending_passwd *****/ +/* +mysql> DESCRIBE usr_pending_passwd; ++-----------------+----------+------+-----+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++-----------------+----------+------+-----+---------+-------+ +| UsrCod | int(11) | NO | PRI | NULL | | +| PendingPassword | char(86) | NO | | NULL | | +| DateAndTime | datetime | NO | | NULL | | ++-----------------+----------+------+-----+---------+-------+ +3 rows in set (0.00 sec) +*/ + DB_CreateTable ("CREATE TABLE IF NOT EXISTS usr_pending_passwd (" + "UsrCod INT NOT NULL," + "PendingPassword CHAR(86) COLLATE latin1_bin NOT NULL," // Pwd_BYTES_ENCRYPTED_PASSWORD + "DateAndTime DATETIME NOT NULL," + "PRIMARY KEY (UsrCod))"); + /***** Table usr_report *****/ /* mysql> DESCRIBE usr_report; diff --git a/swad_mail.c b/swad_mail.c index 6eee36525..589a1a0cb 100644 --- a/swad_mail.c +++ b/swad_mail.c @@ -1625,7 +1625,7 @@ bool Mai_UpdateEmailInDB (const struct UsrData *UsrDat,const char NewEmail[Cns_M /***** Delete email (not confirmed) for other users *****/ DB_QueryDELETE ("can not remove pending email for other users", - "DELETE FROM pending_emails" + "DELETE FROM usr_pending_emails" " WHERE E_mail='%s' AND UsrCod<>%ld", NewEmail,UsrDat->UsrCod); @@ -1738,13 +1738,13 @@ static void Mai_InsertMailKey (const char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1] { /***** Remove expired pending emails from database *****/ DB_QueryDELETE ("can not remove old pending mail keys", - "DELETE LOW_PRIORITY FROM pending_emails" + "DELETE LOW_PRIORITY FROM usr_pending_emails" " WHERE DateAndTime