diff --git a/swad_changelog.h b/swad_changelog.h index ade131c7d..9eb6e5034 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -105,7 +105,6 @@ // TODO: Remove columns "first year, last year, optional, status" when listing degrees? // TODO: Row with total of users in figures // TODO: Show message indicating that mail could be in SPAM folder -// TODO: Remove email address for recipients rejected (mailbox unavailable) // TODO: List institution and centre admins // TODO: List of degrees administrated by a degree admin should be ordered by name @@ -113,11 +112,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.39 (2015/11/16)" +#define Log_PLATFORM_VERSION "SWAD 15.39.1 (2015/11/16)" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1 /* + Version 15.39.1: Nov 16, 2015 User' e-mail can be removed even if it is the unique. (187236 lines) Version 15.39: Nov 16, 2015 Administrators can edit another user' e-mails. (187268 lines) 9 changes necessary in database: INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1475','es','N','Solicitar edición dir. correo invitado'); diff --git a/swad_mail.c b/swad_mail.c index 358c85f45..1cfcc5c7a 100644 --- a/swad_mail.c +++ b/swad_mail.c @@ -75,7 +75,7 @@ static void Mai_PutFormToCreateMailDomain (void); static void Mai_PutHeadMailDomains (void); static void Mai_CreateMailDomain (struct Mail *Mai); -static void Mai_RemoveEmail (const struct UsrData *UsrDat); +static void Mai_RemoveEmail (struct UsrData *UsrDat); static void Mai_RemoveEmailFromDB (long UsrCod,const char *Email); static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe); static void Mai_InsertMailKey (const char *Email,const char MailKey[Mai_LENGTH_EMAIL_CONFIRM_KEY+1]); @@ -1025,23 +1025,23 @@ void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe) fprintf (Gbl.F.Out,"" "" "
"); - - /* Form to remove e-mail */ - if (ItsMe) - Act_FormStart (ActRemMaiMe); - else - { - Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActRemMaiStd : - (UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActRemMaiTch : - ActRemMaiOth)); // Guest, visitor or admin - Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); - } - fprintf (Gbl.F.Out,"", - row[0]); - Lay_PutIconRemove (); - Act_FormEnd (); } + /* Form to remove e-mail */ + if (ItsMe) + Act_FormStart (ActRemMaiMe); + else + { + Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActRemMaiStd : + (UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActRemMaiTch : + ActRemMaiOth)); // Guest, visitor or admin + Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); + } + fprintf (Gbl.F.Out,"", + row[0]); + Lay_PutIconRemove (); + Act_FormEnd (); + /* E-mail */ fprintf (Gbl.F.Out,"%s", NumEmail == 1 ? "USR_ID" : @@ -1125,9 +1125,6 @@ void Mai_RemoveMyUsrEmail (void) /***** Remove user's e-mail *****/ Mai_RemoveEmail (&Gbl.Usrs.Me.UsrDat); - /***** Update list of e-mails *****/ - Mai_GetEmailFromUsrCod (&Gbl.Usrs.Me.UsrDat); - /***** Show my account again *****/ Acc_ShowFormChangeMyAccount (); } @@ -1146,9 +1143,6 @@ void Mai_RemoveOtherUsrEmail (void) /***** Remove user's e-mail *****/ Mai_RemoveEmail (&Gbl.Usrs.Other.UsrDat); - /***** Update list of e-mails *****/ - Mai_GetEmailFromUsrCod (&Gbl.Usrs.Other.UsrDat); - /***** Show user's record *****/ Rec_ShowSharedUsrRecord (Rec_RECORD_LIST,&Gbl.Usrs.Other.UsrDat); } @@ -1160,10 +1154,9 @@ void Mai_RemoveOtherUsrEmail (void) /************************** Remove e-mail address ****************************/ /*****************************************************************************/ -static void Mai_RemoveEmail (const struct UsrData *UsrDat) +static void Mai_RemoveEmail (struct UsrData *UsrDat) { extern const char *Txt_Email_X_removed; - extern const char *Txt_You_can_not_delete_the_current_email; extern const char *Txt_User_not_found_or_you_do_not_have_permission_; char Email[Usr_MAX_BYTES_USR_EMAIL+1]; @@ -1172,17 +1165,15 @@ static void Mai_RemoveEmail (const struct UsrData *UsrDat) /***** Get new e-mail from form *****/ Par_GetParToText ("Email",Email,Usr_MAX_BYTES_USR_EMAIL); - if (strcasecmp (Email,UsrDat->Email)) // Only if not user's current e-mail - { - /***** Remove one of user's old e-mail addresses *****/ - Mai_RemoveEmailFromDB (UsrDat->UsrCod,Email); + /***** Remove one of user's old e-mail addresses *****/ + Mai_RemoveEmailFromDB (UsrDat->UsrCod,Email); - /***** Show message *****/ - sprintf (Gbl.Message,Txt_Email_X_removed,Email); - Lay_ShowAlert (Lay_SUCCESS,Gbl.Message); - } - else - Lay_ShowAlert (Lay_WARNING,Txt_You_can_not_delete_the_current_email); + /***** Show message *****/ + sprintf (Gbl.Message,Txt_Email_X_removed,Email); + Lay_ShowAlert (Lay_SUCCESS,Gbl.Message); + + /***** Update list of e-mails *****/ + Mai_GetEmailFromUsrCod (UsrDat); } else Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); @@ -1212,9 +1203,6 @@ void May_NewMyUsrEmail (void) /***** Remove user's e-mail *****/ Mai_NewUsrEmail (&Gbl.Usrs.Me.UsrDat,true); // It's me - /***** Update list of e-mails *****/ - Mai_GetEmailFromUsrCod (&Gbl.Usrs.Me.UsrDat); - /***** Show my account again *****/ Acc_ShowFormChangeMyAccount (); } @@ -1234,9 +1222,6 @@ void Mai_NewOtherUsrEmail (void) Mai_NewUsrEmail (&Gbl.Usrs.Other.UsrDat, (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)); // It's me? - /***** Update list of e-mails *****/ - Mai_GetEmailFromUsrCod (&Gbl.Usrs.Other.UsrDat); - /***** Show user's record *****/ Rec_ShowSharedUsrRecord (Rec_RECORD_LIST,&Gbl.Usrs.Other.UsrDat); } @@ -1277,16 +1262,17 @@ static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe) { if (Mai_UpdateEmailInDB (UsrDat,NewEmail)) { - /* E-mail updated sucessfully */ - strcpy (UsrDat->Email,NewEmail); - UsrDat->EmailConfirmed = false; - + /***** E-mail updated sucessfully *****/ sprintf (Gbl.Message,Txt_The_email_address_X_has_been_registered_successfully, NewEmail); Lay_ShowAlert (Lay_SUCCESS,Gbl.Message); + /***** Update list of e-mails *****/ + Mai_GetEmailFromUsrCod (UsrDat); + + /***** Send message via email + to confirm the new email address *****/ if (ItsMe) - /* Send message via email to confirm the new email address */ if (Mai_SendMailMsgToConfirmEmail ()) { sprintf (Gbl.Message,Txt_A_message_has_been_sent_to_email_address_X_to_confirm_that_address, diff --git a/swad_text.c b/swad_text.c index b3f254278..625924a3a 100644 --- a/swad_text.c +++ b/swad_text.c @@ -49161,27 +49161,6 @@ const char *Txt_You_can_not_create_links_here = "You can not create links here."; // Necessita de tradução #endif -const char *Txt_You_can_not_delete_the_current_email = -#if L==0 - "No puede eliminar el correo actual."; // Necessita traduccio -#elif L==1 - "You can not delete the current e-mail."; // Need Übersetzung -#elif L==2 - "You can not delete the current e-mail."; -#elif L==3 - "No puede eliminar el correo actual."; -#elif L==4 - "You can not delete the current e-mail."; // Besoin de traduction -#elif L==5 - "No puede eliminar el correo actual."; // Okoteve traducción -#elif L==6 - "Non puoi cancellare il e-mail attuale."; -#elif L==7 - "You can not delete the current e-mail."; // Potrzebujesz tlumaczenie -#elif L==8 - "You can not delete the current e-mail."; // Necessita de tradução -#endif - const char *Txt_You_can_not_delete_your_current_nickname = #if L==0 "No puede eliminar su apodo actual."; // Necessita traduccio diff --git a/swad_user.c b/swad_user.c index 78fe658e8..8014067c5 100644 --- a/swad_user.c +++ b/swad_user.c @@ -555,10 +555,8 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat) /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); - /***** Get nickname *****/ + /***** Get nickname and e-mail *****/ Nck_GetNicknameFromUsrCod (UsrDat->UsrCod,UsrDat->Nickname); - - /***** Get e-mail *****/ Mai_GetEmailFromUsrCod (UsrDat); }