diff --git a/swad_account.c b/swad_account.c index 06281f6c..701e2fc5 100644 --- a/swad_account.c +++ b/swad_account.c @@ -411,23 +411,31 @@ void Acc_ShowFormChangeMyAccount (void) extern const char *Txt_Before_going_to_any_other_option_you_must_fill_your_nickname; extern const char *Txt_Please_fill_in_your_email_address; extern const char *Txt_Please_fill_in_your_ID; - extern const char *Txt_Please_confirm_your_email_address; + extern const char *Txt_Please_check_and_confirm_your_email_address; extern const char *Txt_User_account; + bool IMustFillNickname = false; + bool IMustFillEmail = false; + bool IShouldConfirmEmail = false; + bool IShouldFillID = false; /***** Get current user's nickname and e-mail address It's necessary because current nickname or e-mail could be just updated *****/ Nck_GetNicknameFromUsrCod (Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Me.UsrDat.Nickname); Mai_GetEmailFromUsrCod (&Gbl.Usrs.Me.UsrDat); - /***** Check nickname and e-mail *****/ + /***** Check nickname, e-mail and ID *****/ if (!Gbl.Usrs.Me.UsrDat.Nickname[0]) - Lay_ShowAlert (Lay_WARNING,Txt_Before_going_to_any_other_option_you_must_fill_your_nickname); + IMustFillNickname = true; else if (!Gbl.Usrs.Me.UsrDat.Email[0]) - Lay_ShowAlert (Lay_WARNING,Txt_Please_fill_in_your_email_address); - else if (!Gbl.Usrs.Me.UsrDat.IDs.Num) - Lay_ShowAlert (Lay_WARNING,Txt_Please_fill_in_your_ID); - else if (!Gbl.Usrs.Me.UsrDat.EmailConfirmed) - Lay_ShowAlert (Lay_WARNING,Txt_Please_confirm_your_email_address); + IMustFillEmail = true; + else + { + if (!Gbl.Usrs.Me.UsrDat.EmailConfirmed && // E-mail not yet confirmed + !Gbl.Usrs.Me.ConfirmEmailJustSent) // Do not ask for e-mail confirmation when confirmation e-mail is just sent + IShouldConfirmEmail = true; + if (!Gbl.Usrs.Me.UsrDat.IDs.Num) + IShouldFillID = true; + } /***** Put links to change my password and to remove my account*****/ fprintf (Gbl.F.Out,"
"); @@ -440,18 +448,43 @@ void Acc_ShowFormChangeMyAccount (void) Lay_StartRoundFrameTable (NULL,2,Txt_User_account); /***** Nickname *****/ + if (IMustFillNickname) + { + fprintf (Gbl.F.Out,"" + ""); + Lay_ShowAlert (Lay_WARNING,Txt_Before_going_to_any_other_option_you_must_fill_your_nickname); + fprintf (Gbl.F.Out,"" + ""); + } Nck_ShowFormChangeUsrNickname (); /***** Separator *****/ Acc_PrintAccountSeparator (); /***** E-mail *****/ + if (IMustFillEmail || IShouldConfirmEmail) + { + fprintf (Gbl.F.Out,"" + ""); + Lay_ShowAlert (Lay_WARNING,IMustFillEmail ? Txt_Please_fill_in_your_email_address : + Txt_Please_check_and_confirm_your_email_address); + fprintf (Gbl.F.Out,"" + ""); + } Mai_ShowFormChangeUsrEmail (&Gbl.Usrs.Me.UsrDat,true); /***** Separator *****/ Acc_PrintAccountSeparator (); /***** User's ID *****/ + if (IShouldFillID) + { + fprintf (Gbl.F.Out,"" + ""); + Lay_ShowAlert (Lay_WARNING,Txt_Please_fill_in_your_ID); + fprintf (Gbl.F.Out,"" + ""); + } ID_ShowFormChangeUsrID (&Gbl.Usrs.Me.UsrDat,true); /***** End of table *****/ diff --git a/swad_changelog.h b/swad_changelog.h index a75aa1a5..1b6ef0f8 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -148,13 +148,15 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.18.1 (2016-10-10)" +#define Log_PLATFORM_VERSION "SWAD 16.19 (2016-10-10)" #define CSS_FILE "swad15.229.css" #define JS_FILE "swad15.238.1.js" // 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 16.19: Oct 10, 2016 Warning in User > Session to confirm user's e-mail address. + Changes in form to edit user's account. (205194 lines) Version 16.18.1: Oct 10, 2016 Warning in User > Account to confirm user's e-mail address. (205116 lines) Version 16.18: Oct 09, 2016 Removed external authentication (previously used at University of Granada). (205092 lines) 4 changes necessary in database: diff --git a/swad_global.c b/swad_global.c index 7dac14cf..7587518a 100644 --- a/swad_global.c +++ b/swad_global.c @@ -176,6 +176,7 @@ void Gbl_InitializeGlobals (void) Gbl.Usrs.Me.MyCourses.Num = 0; Gbl.Usrs.Me.MyAdminDegs.Num = 0; Gbl.Usrs.Me.MyAdminDegs.Lst = NULL; + Gbl.Usrs.Me.ConfirmEmailJustSent = false; // An e-mail to confirm my e-mail address has not just been sent Gbl.Usrs.Other.UsrDat.UsrCod = -1L; Gbl.Usrs.Other.UsrDat.UsrIDNickOrEmail[0] = '\0'; diff --git a/swad_global.h b/swad_global.h index 7fd6bf0d..7698132f 100644 --- a/swad_global.h +++ b/swad_global.h @@ -301,6 +301,7 @@ struct Globals unsigned NumAccWithoutPhoto; char PhotoURL[PATH_MAX+1]; time_t TimeLastAccToThisFileBrowser; + bool ConfirmEmailJustSent; // An e-mail to confirm my e-mail address has just been sent struct { bool Filled; // My institutions are already filled? diff --git a/swad_mail.c b/swad_mail.c index 2cf375ab..b84d12c2 100644 --- a/swad_mail.c +++ b/swad_mail.c @@ -1474,7 +1474,29 @@ bool Mai_UpdateEmailInDB (const struct UsrData *UsrDat,const char *NewEmail) } /*****************************************************************************/ -/********************** Show form for changing my password *******************/ +/********** Put button to go to check and confirm my e-mail address **********/ +/*****************************************************************************/ + +void Mai_PutButtonToCheckEmailAddress (void) + { + extern const char *Txt_Email_unconfirmed; + extern const char *Txt_Please_check_and_confirm_your_email_address; + extern const char *Txt_Check; + + /***** Start form *****/ + Act_FormStart (ActFrmUsrAcc); + + /***** Frame with button to go to account *****/ + Lay_StartRoundFrame (NULL,Txt_Email_unconfirmed,NULL); + Lay_ShowAlert (Lay_WARNING,Txt_Please_check_and_confirm_your_email_address); + Lay_EndRoundFrameWithButton (Lay_CONFIRM_BUTTON,Txt_Check); + + /***** End form *****/ + Act_FormEnd (); + } + +/*****************************************************************************/ +/************** Send mail message to confirm my e-mail address ***************/ /*****************************************************************************/ // Return true on success // Return false on error @@ -1523,6 +1545,7 @@ bool Mai_SendMailMsgToConfirmEmail (void) ReturnCode = system (Command); if (ReturnCode == -1) Lay_ShowErrorAndExit ("Error when running script to send e-mail."); + Gbl.Usrs.Me.ConfirmEmailJustSent = true; /***** Remove temporary file *****/ unlink (Gbl.Msg.FileNameMail); @@ -1535,14 +1558,12 @@ bool Mai_SendMailMsgToConfirmEmail (void) return true; case 1: Lay_ShowAlert (Lay_WARNING,Txt_There_was_a_problem_sending_an_email_automatically); - // Lay_ShowAlert (Lay_ERROR,Command); return false; default: sprintf (Gbl.Message,"Internal error: an email message has not been sent successfully." " Error code returned by the script: %d", ReturnCode); Lay_ShowAlert (Lay_ERROR,Gbl.Message); - // Lay_ShowAlert (Lay_ERROR,Command); return false; } } diff --git a/swad_mail.h b/swad_mail.h index a8789540..eaa07a1a 100644 --- a/swad_mail.h +++ b/swad_mail.h @@ -80,6 +80,8 @@ void Mai_RemoveOtherUsrEmail (void); void May_NewMyUsrEmail (void); void Mai_NewOtherUsrEmail (void); bool Mai_UpdateEmailInDB (const struct UsrData *UsrDat,const char *NewEmail); + +void Mai_PutButtonToCheckEmailAddress (void); bool Mai_SendMailMsgToConfirmEmail (void); void Mai_ConfirmEmail (void); diff --git a/swad_text.c b/swad_text.c index 18522f00..f42bdbf2 100644 --- a/swad_text.c +++ b/swad_text.c @@ -4489,7 +4489,7 @@ const char *Txt_Chat_rooms = "Chat rooms"; #endif -const char *Txt_Check = // Button to check if an account is already created with a user's ID +const char *Txt_Check = #if L==1 "Comprovar"; #elif L==2 @@ -4981,7 +4981,7 @@ const char *Txt_Congratulations_You_have_created_your_account_X_Now_Y_will_reque " vostè pot crear abans de sol·licitar la vostra inscripció en ella" " (el mateix és aplicable a institucions, centres i titulacions)."; #elif L==2 - "Herzlichen Glückwunsch! Du hast Dein Benutzerkonto @%s erstellt." + "Herzlichen Glückwunsch! Du hast Dein Benutzerkonto @%s erstellt." " Jetzt %s finden Sie einige Daten in Ihrem Profil." " Vervollständigen anfordern und dann werden Sie in der Lage," " für die Einschreibung in Kurse an." @@ -4989,48 +4989,48 @@ const char *Txt_Congratulations_You_have_created_your_account_X_Now_Y_will_reque " können Sie es vor der Anwendung für die Immatrikulation in es zu erstellen" " (das gleiche gilt für Einrichtungen, Zentren und Grad)."; #elif L==3 - "Congratulations! You have created your account @%s." + "Congratulations! You have created your account @%s." " Now %s will request you some data to complete your profile." " Then you will be able to apply for enrollment in courses." " If a course does not exist," " you can create it before applying for enrollment in it" " (the same applies to institutions, centres and degrees)."; #elif L==4 - "¡Enhorabuena! Ha creado su cuenta @%s." + "¡Enhorabuena! Ha creado su cuenta @%s." " Ahora %s le solicitará algunos datos para completar su perfil." " Usted podrá después solicitar su inscripción en asignaturas." " Si una asignatura no existe," " puede crearla antes de solicitar su inscripción en ella" " (lo mismo es aplicable a instituciones, centros y titulaciones)."; #elif L==5 - "Félicitations! Vous avez créé votre compte @%s." + "Félicitations! Vous avez créé votre compte @%s." " Maintenant %s vous demanderá certaines données pour compléter votre profil." " Vous serez alors en mesure de demander l'inscription à des matières." " Si une matière ne existe pas," " vous pouvez le créer avant de demander l'inscription en elle" " (la même chose se applique aux institutions, centres et degrés)."; #elif L==6 - "¡Enhorabuena! Ha creado su cuenta @%s." + "¡Enhorabuena! Ha creado su cuenta @%s." " Ahora %s le solicitará algunos datos para completar su perfil." " Usted podrá después solicitar su inscripción en asignaturas." " Si una asignatura no existe," " puede crearla antes de solicitar su inscripción en ella" " (lo mismo es aplicable a instituciones, centros y titulaciones)."; // Okoteve traducción #elif L==7 - "Congratulazioni! Avete creato il vostro account %s." + "Congratulazioni! Avete creato il vostro account @%s." " Ora %s chiederà alcuni dati per completare il tuo profilo." " Allora si sarà in grado di applicare per l'iscrizione ai corsi." " Se un corso non esiste, è possibile crearlo prima di applicare per l'iscrizione in esso" " (lo stesso vale per le istituzioni, centri e gradi)."; #elif L==8 - "Gratulujemy! Utworzeniu konta @%s." + "Gratulujemy! Utworzeniu konta @%s." " Teraz %s zwróci Ci kilka danych, aby zakończyć swój profil." " Następnie będzie można ubiegać się o przyjęcie na kursy." " Jeśli kurs nie istnieje," " można go utworzyć przed ubieganiem siè o przyjęcie w nim" " (to samo odnosi się do instytucji, placówek i stopni)."; #elif L==9 - "Parabéns! Você criou seu ACC conta." + "Parabéns! Você criou seu conta @%s." " Agora %s vai pedir-lhe alguns dados para completar o seu perfil." " Em seguida, você será capaz de aplicar para a matrícula em cursos." " Se uma disciplina não existir," @@ -10398,6 +10398,27 @@ const char *Txt_Email_X_removed = // Warning: it is very important to include %s "E-mail %s removido."; #endif +const char *Txt_Email_unconfirmed = +#if L==1 + "Correo no confirmado"; // Necessita traduccio +#elif L==2 + "E-mail unconfirmed"; // Need Übersetzung +#elif L==3 + "E-mail unconfirmed"; +#elif L==4 + "Correo no confirmado"; +#elif L==5 + "E-mail unconfirmed"; // Besoin de traduction +#elif L==6 + "Correo no confirmado"; // Okoteve traducción +#elif L==7 + "E-mail unconfirmed"; // Bisogno di traduzione +#elif L==8 + "E-mail unconfirmed"; // Potrzebujesz tlumaczenie +#elif L==9 + "E-mail unconfirmed"; // Necessita de tradução +#endif + const char *Txt_End_date = #if L==1 "Data final"; @@ -28302,25 +28323,25 @@ const char *Txt_PLACES_ORDER[2] = #endif }; -const char *Txt_Please_confirm_your_email_address = +const char *Txt_Please_check_and_confirm_your_email_address = #if L==1 - "Si us plau, confirmeu la vostra adreça de correu."; + "Si us plau, comproveu i confirmeu la vostra adreça de correu."; #elif L==2 - "Bitte bestätigen Sie Ihre E-Mail-Adresse."; + "Bitte überprüfen Sie und Ihre E-Mail-Adresse bestätigen."; #elif L==3 - "Please confirm your email address."; + "Please check and confirm your email address."; #elif L==4 - "Por favor, confirme su dirección de correo."; + "Por favor, compruebe y confirme su dirección de correo."; #elif L==5 - "S'il vous plaít, confirmez votre adresse e-mail."; + "S'il vous plaít, vérifiez et confirmez votre adresse e-mail."; #elif L==6 - "Por favor, confirme su dirección de correo."; // Okoteve traducción + "Por favor, compruebe y confirme su dirección de correo."; // Okoteve traducción #elif L==7 - "Per favore, conferma il tuo indirizzo e-mail."; + "Per favore, verifica e conferma il tuo indirizzo e-mail."; #elif L==8 - "Proszę, potwierdź swój w tym adresu e-mail."; + "Proszę sprawdzić i potwierdzić swój adres e-mail."; #elif L==9 - "Por favor, por favor confirme o seu endereço de e-mail."; + "Por favor, verificar e confirmar o seu endereço de e-mail."; #endif const char *Txt_Please_enter_your_ID = @@ -46792,21 +46813,21 @@ const char *Txt_There_was_a_problem_sending_an_email_automatically = #if L==1 "Ha ocurrido un problema enviando automáticamente un correo."; // Necessita traduccio #elif L==2 - "There was a problem sending an email automatically."; // Übersetzung notwendig + "There was a problem sending an email automatically."; // Übersetzung notwendig #elif L==3 "There was a problem sending an email automatically."; #elif L==4 "Ha ocurrido un problema enviando automáticamente un correo."; #elif L==5 - "There was a problem sending an email automatically."; // Besoin de traduction + "There was a problem sending an email automatically."; // Besoin de traduction #elif L==6 "Ha ocurrido un problema enviando automáticamente un correo."; // Okoteve traducción #elif L==7 "C'è stato un problema inviando automaticamente un'e-mail."; #elif L==8 - "There was a problem sending an email automatically."; // Potrzebujesz tlumaczenie + "There was a problem sending an email automatically."; // Potrzebujesz tlumaczenie #elif L==9 - "There was a problem sending an email automatically."; // Necessita de tradução + "There was a problem sending an email automatically."; // Necessita de tradução #endif const char *Txt_There_was_an_error_in_assessing_the_test_X = // Warning: it is very important to include %u in the following sentences diff --git a/swad_user.c b/swad_user.c index f21f6ee5..2724254b 100644 --- a/swad_user.c +++ b/swad_user.c @@ -1685,9 +1685,9 @@ void Usr_WelcomeUsr (void) { extern const unsigned Txt_Current_CGI_SWAD_Language; extern const char *Txt_Happy_birthday; - extern const char *Txt_Welcome[Usr_NUM_SEXS]; - extern const char *Txt_Welcome_X[Usr_NUM_SEXS]; extern const char *Txt_Welcome_X_and_happy_birthday[Usr_NUM_SEXS]; + extern const char *Txt_Welcome_X[Usr_NUM_SEXS]; + extern const char *Txt_Welcome[Usr_NUM_SEXS]; extern const char *Txt_Switching_to_LANGUAGE[1+Txt_NUM_LANGUAGES]; bool CongratulateMyBirthday; @@ -1724,6 +1724,11 @@ void Usr_WelcomeUsr (void) else Lay_ShowAlert (Lay_INFO,Txt_Welcome[Gbl.Usrs.Me.UsrDat.Sex]); + /***** Warning to confirm my e-mail address *****/ + if (Gbl.Usrs.Me.UsrDat.Email[0] && + !Gbl.Usrs.Me.UsrDat.EmailConfirmed) + Mai_PutButtonToCheckEmailAddress (); + /***** Show help to enroll me *****/ Hlp_ShowHelpWhatWouldYouLikeToDo ();