Version 16.19

This commit is contained in:
Antonio Cañas Vargas 2016-10-10 19:25:25 +02:00
parent 2b6d07deeb
commit 97624f3d5b
8 changed files with 123 additions and 37 deletions

View File

@ -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,"<div class=\"CONTEXT_MENU\">");
@ -440,18 +448,43 @@ void Acc_ShowFormChangeMyAccount (void)
Lay_StartRoundFrameTable (NULL,2,Txt_User_account);
/***** Nickname *****/
if (IMustFillNickname)
{
fprintf (Gbl.F.Out,"<tr>"
"<td colspan=\"2\">");
Lay_ShowAlert (Lay_WARNING,Txt_Before_going_to_any_other_option_you_must_fill_your_nickname);
fprintf (Gbl.F.Out,"</td>"
"</tr>");
}
Nck_ShowFormChangeUsrNickname ();
/***** Separator *****/
Acc_PrintAccountSeparator ();
/***** E-mail *****/
if (IMustFillEmail || IShouldConfirmEmail)
{
fprintf (Gbl.F.Out,"<tr>"
"<td colspan=\"2\">");
Lay_ShowAlert (Lay_WARNING,IMustFillEmail ? Txt_Please_fill_in_your_email_address :
Txt_Please_check_and_confirm_your_email_address);
fprintf (Gbl.F.Out,"</td>"
"</tr>");
}
Mai_ShowFormChangeUsrEmail (&Gbl.Usrs.Me.UsrDat,true);
/***** Separator *****/
Acc_PrintAccountSeparator ();
/***** User's ID *****/
if (IShouldFillID)
{
fprintf (Gbl.F.Out,"<tr>"
"<td colspan=\"2\">");
Lay_ShowAlert (Lay_WARNING,Txt_Please_fill_in_your_ID);
fprintf (Gbl.F.Out,"</td>"
"</tr>");
}
ID_ShowFormChangeUsrID (&Gbl.Usrs.Me.UsrDat,true);
/***** End of table *****/

View File

@ -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:

View File

@ -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';

View File

@ -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?

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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&egrave; pot crear abans de sol&middot;licitar la vostra inscripci&oacute; en ella"
" (el mateix &eacute;s aplicable a institucions, centres i titulacions).";
#elif L==2
"Herzlichen Gl&uuml;ckwunsch! Du hast Dein Benutzerkonto @%s erstellt."
"Herzlichen Gl&uuml;ckwunsch! Du hast Dein Benutzerkonto <strong>@%s</strong> erstellt."
" Jetzt %s finden Sie einige Daten in Ihrem Profil."
" Vervollst&auml;ndigen anfordern und dann werden Sie in der Lage,"
" f&uuml;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&ouml;nnen Sie es vor der Anwendung f&uuml;r die Immatrikulation in es zu erstellen"
" (das gleiche gilt f&uuml;r Einrichtungen, Zentren und Grad).";
#elif L==3
"Congratulations! You have created your account @%s."
"Congratulations! You have created your account <strong>@%s</strong>."
" 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
"&iexcl;Enhorabuena! Ha creado su cuenta @%s."
"&iexcl;Enhorabuena! Ha creado su cuenta <strong>@%s</strong>."
" Ahora %s le solicitar&aacute; algunos datos para completar su perfil."
" Usted podr&aacute; despu&eacute;s solicitar su inscripci&oacute;n en asignaturas."
" Si una asignatura no existe,"
" puede crearla antes de solicitar su inscripci&oacute;n en ella"
" (lo mismo es aplicable a instituciones, centros y titulaciones).";
#elif L==5
"F&eacute;licitations! Vous avez cr&eacute;&eacute; votre compte @%s."
"F&eacute;licitations! Vous avez cr&eacute;&eacute; votre compte <strong>@%s</strong>."
" Maintenant %s vous demander&aacute; certaines donn&eacute;es pour compl&eacute;ter votre profil."
" Vous serez alors en mesure de demander l'inscription &agrave; des mati&egrave;res."
" Si une mati&egrave;re ne existe pas,"
" vous pouvez le cr&eacute;er avant de demander l'inscription en elle"
" (la m&ecirc;me chose se applique aux institutions, centres et degr&eacute;s).";
#elif L==6
"&iexcl;Enhorabuena! Ha creado su cuenta @%s."
"&iexcl;Enhorabuena! Ha creado su cuenta <strong>@%s</strong>."
" Ahora %s le solicitar&aacute; algunos datos para completar su perfil."
" Usted podr&aacute; despu&eacute;s solicitar su inscripci&oacute;n en asignaturas."
" Si una asignatura no existe,"
" puede crearla antes de solicitar su inscripci&oacute;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 <strong>@%s</strong>."
" Ora %s chieder&agrave; alcuni dati per completare il tuo profilo."
" Allora si sar&agrave; in grado di applicare per l'iscrizione ai corsi."
" Se un corso non esiste, &egrave; 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 <strong>@%s</strong>."
" Teraz %s zwr&oacute;ci Ci kilka danych, aby zako&nacute;czy&cacute; sw&oacute;j profil."
" Nast&eogon;pnie b&eogon;dzie mo&zdot;na ubiega&cacute; si&eogon; o przyj&eogon;cie na kursy."
" Je&sacute;li kurs nie istnieje,"
" mo&zdot;na go utworzy&cacute; przed ubieganiem si&egrave; o przyj&eogon;cie w nim"
" (to samo odnosi si&eogon; do instytucji, plac&oacute;wek i stopni).";
#elif L==9
"Parab&eacute;ns! Voc&ecirc; criou seu ACC conta."
"Parab&eacute;ns! Voc&ecirc; criou seu conta <strong>@%s</strong>."
" Agora %s vai pedir-lhe alguns dados para completar o seu perfil."
" Em seguida, voc&ecirc; ser&aacute; capaz de aplicar para a matrícula em cursos."
" Se uma disciplina n&atilde;o existir,"
@ -10398,6 +10398,27 @@ const char *Txt_Email_X_removed = // Warning: it is very important to include %s
"E-mail <strong>%s</strong> 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&ccedil;a de correu.";
"Si us plau, comproveu i confirmeu la vostra adre&ccedil;a de correu.";
#elif L==2
"Bitte best&auml;tigen Sie Ihre E-Mail-Adresse.";
"Bitte &uuml;berpr&uuml;fen Sie und Ihre E-Mail-Adresse best&auml;tigen.";
#elif L==3
"Please confirm your email address.";
"Please check and confirm your email address.";
#elif L==4
"Por favor, confirme su direcci&oacute;n de correo.";
"Por favor, compruebe y confirme su direcci&oacute;n de correo.";
#elif L==5
"S'il vous pla&iacute;t, confirmez votre adresse e-mail.";
"S'il vous pla&iacute;t, v&eacute;rifiez et confirmez votre adresse e-mail.";
#elif L==6
"Por favor, confirme su direcci&oacute;n de correo."; // Okoteve traducción
"Por favor, compruebe y confirme su direcci&oacute;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&eogon;, potwierd&zacute; sw&oacute;j w tym adresu e-mail.";
"Prosz&eogon; sprawdzi&cacute; i potwierdzi&cacute; sw&oacute;j adres e-mail.";
#elif L==9
"Por favor, por favor confirme o seu endere&ccedil;o de e-mail.";
"Por favor, verificar e confirmar o seu endere&ccedil;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&aacute;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&aacute;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&aacute;ticamente un correo."; // Okoteve traducción
#elif L==7
"C'&egrave; 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

View File

@ -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 ();