mirror of https://github.com/acanas/swad-core.git
Version 18.5
This commit is contained in:
parent
a659725393
commit
771d77048d
61
swad_ID.c
61
swad_ID.c
|
@ -52,8 +52,6 @@ extern struct Globals Gbl;
|
|||
|
||||
#define ID_MAX_IDS_PER_USER 3 // Maximum number of IDs per user
|
||||
|
||||
#define ID_ID_SECTION_ID "id_section"
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Private types *******************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -62,6 +60,8 @@ extern struct Globals Gbl;
|
|||
/***************************** Private variables *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
const char *ID_ID_SECTION_ID = "id_section";
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Private prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -502,45 +502,6 @@ static void ID_PutLinkToConfirmID (struct UsrData *UsrDat,unsigned NumID,
|
|||
Act_EndForm ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********** Put a link to the action used to request user's IDs *************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void ID_PutLinkToChangeUsrIDs (void)
|
||||
{
|
||||
extern const char *Txt_Change_IDs;
|
||||
Act_Action_t NextAction;
|
||||
bool ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
/***** Link for changing the password *****/
|
||||
if (ItsMe)
|
||||
Lay_PutContextualLink (ActFrmMyAcc,NULL,NULL,
|
||||
"arroba64x64.gif",
|
||||
Txt_Change_IDs,Txt_Change_IDs,
|
||||
NULL);
|
||||
else // Not me
|
||||
{
|
||||
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActFrmIDsStd;
|
||||
break;
|
||||
case Rol_NET:
|
||||
case Rol_TCH:
|
||||
NextAction = ActFrmIDsTch;
|
||||
break;
|
||||
default: // Guest, user or admin
|
||||
NextAction = ActFrmIDsOth;
|
||||
break;
|
||||
}
|
||||
Lay_PutContextualLink (NextAction,NULL,
|
||||
Usr_PutParamOtherUsrCodEncrypted,
|
||||
"arroba64x64.gif",
|
||||
Txt_Change_IDs,Txt_Change_IDs,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Show form to the change of IDs of another user ****************/
|
||||
/*****************************************************************************/
|
||||
|
@ -622,14 +583,26 @@ void ID_ShowFormChangeMyID (bool IShouldFillID)
|
|||
|
||||
void ID_ShowFormChangeOtherUsrID (void)
|
||||
{
|
||||
extern const char *Hlp_PROFILE_Account;
|
||||
extern const char *Txt_ID;
|
||||
char StrRecordWidth[10 + 1];
|
||||
|
||||
/***** Start section *****/
|
||||
Lay_StartSection (ID_ID_SECTION_ID);
|
||||
|
||||
/***** Start box *****/
|
||||
sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH);
|
||||
Box_StartBox (StrRecordWidth,Txt_ID,NULL,
|
||||
Hlp_PROFILE_Account,Box_NOT_CLOSABLE);
|
||||
|
||||
/***** Show form to change ID *****/
|
||||
ID_ShowFormChangeUsrID (&Gbl.Usrs.Other.UsrDat,
|
||||
false, // ItsMe
|
||||
false); // IShouldFillID
|
||||
|
||||
/***** End box *****/
|
||||
Box_EndBox ();
|
||||
|
||||
/***** End section *****/
|
||||
Lay_EndSection ();
|
||||
}
|
||||
|
@ -835,7 +808,7 @@ void ID_RemoveOtherUsrID (void)
|
|||
ID_GetListIDsFromUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
|
||||
/***** Show form again *****/
|
||||
ID_ShowFormOthIDs ();
|
||||
Acc_ShowFormChgOtherUsrAccount ();
|
||||
}
|
||||
else // User not found
|
||||
{
|
||||
|
@ -936,7 +909,7 @@ static void ID_RemoveUsrIDFromDB (long UsrCod,const char *UsrID)
|
|||
|
||||
void ID_NewMyUsrID (void)
|
||||
{
|
||||
/***** Remove user's ID *****/
|
||||
/***** New user's ID *****/
|
||||
ID_NewUsrID (&Gbl.Usrs.Me.UsrDat,
|
||||
true); // It's me
|
||||
|
||||
|
@ -967,7 +940,7 @@ void ID_NewOtherUsrID (void)
|
|||
ID_GetListIDsFromUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
|
||||
/***** Show form again *****/
|
||||
ID_ShowFormOthIDs ();
|
||||
Acc_ShowFormChgOtherUsrAccount ();
|
||||
}
|
||||
else // User not found
|
||||
{
|
||||
|
|
|
@ -72,7 +72,6 @@ bool ID_CheckIfUsrIDSeemsAValidID (const char *UsrID);
|
|||
void ID_WriteUsrIDs (struct UsrData *UsrDat,const char *Anchor);
|
||||
bool ID_ICanSeeOtherUsrIDs (const struct UsrData *UsrDat);
|
||||
|
||||
void ID_PutLinkToChangeUsrIDs (void);
|
||||
void ID_ShowFormOthIDs (void);
|
||||
void ID_ShowFormChangeMyID (bool IShouldFillID);
|
||||
void ID_ShowFormChangeOtherUsrID (void);
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "swad_global.h"
|
||||
#include "swad_ID.h"
|
||||
#include "swad_language.h"
|
||||
#include "swad_nickname.h"
|
||||
#include "swad_notification.h"
|
||||
#include "swad_parameter.h"
|
||||
#include "swad_profile.h"
|
||||
|
@ -469,6 +470,53 @@ void Acc_ShowFormChgMyAccount (void)
|
|||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Show form to change another user's account ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Acc_ShowFormChgOtherUsrAccount (void)
|
||||
{
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
|
||||
/***** Get user whose account must be changed *****/
|
||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
{
|
||||
if (Usr_ICanEditOtherUsr (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
/***** Get user's nickname and email address
|
||||
It's necessary because nickname or email could be just updated *****/
|
||||
Nck_GetNicknameFromUsrCod (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.Usrs.Other.UsrDat.Nickname);
|
||||
Mai_GetEmailFromUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
|
||||
/***** Show user's record *****/
|
||||
Rec_ShowSharedUsrRecord (Rec_SHA_RECORD_LIST,
|
||||
&Gbl.Usrs.Other.UsrDat,NULL);
|
||||
|
||||
/***** Start container for this user *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"REC_USR\">");
|
||||
|
||||
/***** Show form to change nickname and email *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"REC_LEFT\">");
|
||||
Nck_ShowFormChangeOtherUsrNickname ();
|
||||
Mai_ShowFormChangeOtherUsrEmail ();
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
|
||||
/***** Show form to change ID and password *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"REC_RIGHT\">");
|
||||
ID_ShowFormChangeOtherUsrID ();
|
||||
Pwd_ShowFormChgOtherUsrPwd ();
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
|
||||
/***** Start container for this user *****/
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
else
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
else // User not found
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Put an icon (form) to request removing my account *************/
|
||||
/*****************************************************************************/
|
||||
|
@ -518,7 +566,7 @@ bool Acc_CreateMyNewAccountAndLogIn (void)
|
|||
true); // I am creating my own account
|
||||
|
||||
/***** Save nickname *****/
|
||||
Nck_UpdateMyNick (NewNicknameWithoutArroba);
|
||||
Nck_UpdateNickInDB (Gbl.Usrs.Me.UsrDat.UsrCod,NewNicknameWithoutArroba);
|
||||
Str_Copy (Gbl.Usrs.Me.UsrDat.Nickname,NewNicknameWithoutArroba,
|
||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
|
||||
|
@ -1150,3 +1198,42 @@ static void Acc_RemoveUsr (struct UsrData *UsrDat)
|
|||
UsrDat->UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user's data");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********* Put an icon to the action used to manage user's account ***********/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Acc_PutIconToChangeUsrAccount (void)
|
||||
{
|
||||
extern const char *Txt_Change_account;
|
||||
Act_Action_t NextAction;
|
||||
bool ItsMe = Usr_ItsMe (Gbl.Record.UsrDat->UsrCod);
|
||||
|
||||
/***** Link for changing the account *****/
|
||||
if (ItsMe)
|
||||
Lay_PutContextualLink (ActFrmMyAcc,NULL,NULL,
|
||||
"arroba64x64.gif",
|
||||
Txt_Change_account,NULL,
|
||||
NULL);
|
||||
else // Not me
|
||||
if (Usr_ICanEditOtherUsr (Gbl.Record.UsrDat))
|
||||
{
|
||||
switch (Gbl.Record.UsrDat->Roles.InCurrentCrs.Role)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActFrmAccStd;
|
||||
break;
|
||||
case Rol_NET:
|
||||
case Rol_TCH:
|
||||
NextAction = ActFrmAccTch;
|
||||
break;
|
||||
default: // Guest, user or admin
|
||||
NextAction = ActFrmAccOth;
|
||||
break;
|
||||
}
|
||||
Lay_PutContextualLink (NextAction,NULL,Rec_PutParamUsrCodEncrypted,
|
||||
"arroba64x64.gif",
|
||||
Txt_Change_account,NULL,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ void Acc_CheckIfEmptyAccountExists (void);
|
|||
|
||||
void Acc_ShowFormGoToRequestNewAccount (void);
|
||||
void Acc_ShowFormChgMyAccount (void);
|
||||
void Acc_ShowFormChgOtherUsrAccount (void);
|
||||
void Acc_PutLinkToRemoveMyAccount (void);
|
||||
bool Acc_CreateMyNewAccountAndLogIn (void);
|
||||
void Acc_CreateNewUsr (struct UsrData *UsrDat,bool CreatingMyOwnAccount);
|
||||
|
@ -71,4 +72,6 @@ void Acc_RemoveMyAccount (void);
|
|||
void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
|
||||
Cns_QuietOrVerbose_t QuietOrVerbose);
|
||||
|
||||
void Acc_PutIconToChangeUsrAccount (void);
|
||||
|
||||
#endif
|
||||
|
|
103
swad_action.c
103
swad_action.c
|
@ -1205,26 +1205,28 @@ Users:
|
|||
1010. ActCnfID_Std Confirm another user's ID
|
||||
1011. ActCnfID_Tch Confirm another user's ID
|
||||
|
||||
1012. ActFrmIDsOth Show form to the change of the IDs of another user
|
||||
1013. ActFrmIDsStd Show form to the change of the IDs of another user
|
||||
1014. ActFrmIDsTch Show form to the change of the IDs of another user
|
||||
1015. ActRemID_Oth Remove one of the IDs of another user
|
||||
1016. ActRemID_Std Remove one of the IDs of another user
|
||||
1017. ActRemID_Tch Remove one of the IDs of another user
|
||||
1018. ActNewID_Oth Create a new user's ID for another user
|
||||
1019. ActNewID_Std Create a new user's ID for another user
|
||||
1020. ActNewID_Tch Create a new user's ID for another user
|
||||
1012. ActFrmAccOth Show forms to the change another user's account
|
||||
1013. ActFrmAccStd Show forms to the change another user's account
|
||||
1014. ActFrmAccTch Show forms to the change another user's account
|
||||
|
||||
1021. ActFrmPwdOth Show form to change the password of another user
|
||||
1022. ActFrmPwdStd Show form to change the password of another user
|
||||
1023. ActFrmPwdTch Show form to change the password of another user
|
||||
1024. ActChgPwdOth Change the password of another user
|
||||
1025. ActChgPwdStd Change the password of another user
|
||||
1026. ActChgPwdTch Change the password of another user
|
||||
1015. ActRemOldNicOth Remove one of another user's old nicknames
|
||||
1016. ActRemOldNicStd Remove one of another user's old nicknames
|
||||
1017. ActRemOldNicTch Remove one of another user's old nicknames
|
||||
1018. ActChgNicOth Change another user's nickname
|
||||
1019. ActChgNicStd Change another user's nickname
|
||||
1020. ActChgNicTch Change another user's nickname
|
||||
|
||||
1021. ActRemID_Oth Remove one of the IDs of another user
|
||||
1022. ActRemID_Std Remove one of the IDs of another user
|
||||
1023. ActRemID_Tch Remove one of the IDs of another user
|
||||
1024. ActNewID_Oth Create a new user's ID for another user
|
||||
1025. ActNewID_Std Create a new user's ID for another user
|
||||
1026. ActNewID_Tch Create a new user's ID for another user
|
||||
|
||||
1027. ActChgPwdOth Change the password of another user
|
||||
1028. ActChgPwdStd Change the password of another user
|
||||
1029. ActChgPwdTch Change the password of another user
|
||||
|
||||
1027. ActFrmMaiOth Show form to the change of the email of another user
|
||||
1028. ActFrmMaiStd Show form to the change of the email of another user
|
||||
1029. ActFrmMaiTch Show form to the change of the email of another user
|
||||
1030. ActRemMaiOth Remove one of the email of another user
|
||||
1031. ActRemMaiStd Remove one of the email of another user
|
||||
1032. ActRemMaiTch Remove one of the email of another user
|
||||
|
@ -1526,8 +1528,8 @@ Profile:
|
|||
1303. ActCreUsrAcc Create new user account
|
||||
1304. ActRemID_Me Remove one of my user's IDs
|
||||
1305. ActNewIDMe Create a new user's ID for me
|
||||
1306. ActRemOldNic Remove one of my old nicknames
|
||||
1307. ActChgNic Change my nickname
|
||||
1306. ActRemOldNicMe Remove one of my old nicknames
|
||||
1307. ActChgNicMe Change my nickname
|
||||
1308. ActRemMaiMe Remove one of my old emails
|
||||
1309. ActNewMaiMe Change my email address
|
||||
1310. ActCnfMai Confirm email address
|
||||
|
@ -2776,9 +2778,17 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
/* ActCnfID_Std */{1569,-1,TabUnk,ActLstStd ,0x3F0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ID_ConfirmOtherUsrID ,NULL},
|
||||
/* ActCnfID_Tch */{1570,-1,TabUnk,ActLstTch ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ID_ConfirmOtherUsrID ,NULL},
|
||||
|
||||
/* ActFrmIDsOth */{1447,-1,TabUnk,ActLstOth ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ID_ShowFormOthIDs ,NULL},
|
||||
/* ActFrmIDsStd */{1448,-1,TabUnk,ActLstStd ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ID_ShowFormOthIDs ,NULL},
|
||||
/* ActFrmIDsTch */{1449,-1,TabUnk,ActLstTch ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ID_ShowFormOthIDs ,NULL},
|
||||
/* ActFrmAccOth */{1735,-1,TabUnk,ActLstOth ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Acc_ShowFormChgOtherUsrAccount ,NULL},
|
||||
/* ActFrmAccStd */{1736,-1,TabUnk,ActLstStd ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Acc_ShowFormChgOtherUsrAccount ,NULL},
|
||||
/* ActFrmAccTch */{1737,-1,TabUnk,ActLstTch ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Acc_ShowFormChgOtherUsrAccount ,NULL},
|
||||
|
||||
/* ActRemOldNicOth */{1738,-1,TabUnk,ActLstOth ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Nck_RemoveOtherUsrNick ,NULL},
|
||||
/* ActRemOldNicStd */{1739,-1,TabUnk,ActLstStd ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Nck_RemoveOtherUsrNick ,NULL},
|
||||
/* ActRemOldNicTch */{1740,-1,TabUnk,ActLstTch ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Nck_RemoveOtherUsrNick ,NULL},
|
||||
/* ActChgNicOth */{1741,-1,TabUnk,ActLstOth ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Nck_UpdateOtherUsrNick ,NULL},
|
||||
/* ActChgNicStd */{1742,-1,TabUnk,ActLstStd ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Nck_UpdateOtherUsrNick ,NULL},
|
||||
/* ActChgNicTch */{1743,-1,TabUnk,ActLstTch ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Nck_UpdateOtherUsrNick ,NULL},
|
||||
|
||||
/* ActRemID_Oth */{1450,-1,TabUnk,ActLstOth ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ID_RemoveOtherUsrID ,NULL},
|
||||
/* ActRemID_Std */{1451,-1,TabUnk,ActLstStd ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ID_RemoveOtherUsrID ,NULL},
|
||||
/* ActRemID_Tch */{1452,-1,TabUnk,ActLstTch ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ID_RemoveOtherUsrID ,NULL},
|
||||
|
@ -2786,16 +2796,10 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
/* ActNewID_Std */{1454,-1,TabUnk,ActLstStd ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ID_NewOtherUsrID ,NULL},
|
||||
/* ActNewID_Tch */{1455,-1,TabUnk,ActLstTch ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ID_NewOtherUsrID ,NULL},
|
||||
|
||||
/* ActFrmPwdOth */{1464,-1,TabUnk,ActLstOth ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Pwd_ShowFormOthPwd ,NULL},
|
||||
/* ActFrmPwdStd */{1465,-1,TabUnk,ActLstStd ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Pwd_ShowFormOthPwd ,NULL},
|
||||
/* ActFrmPwdTch */{1466,-1,TabUnk,ActLstTch ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Pwd_ShowFormOthPwd ,NULL},
|
||||
/* ActChgPwdOth */{1467,-1,TabUnk,ActLstOth ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,Pwd_UpdateOtherPwd ,Pwd_ShowFormOthPwd ,NULL},
|
||||
/* ActChgPwdStd */{1468,-1,TabUnk,ActLstStd ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,Pwd_UpdateOtherPwd ,Pwd_ShowFormOthPwd ,NULL},
|
||||
/* ActChgPwdTch */{1469,-1,TabUnk,ActLstTch ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,Pwd_UpdateOtherPwd ,Pwd_ShowFormOthPwd ,NULL},
|
||||
/* ActChgPwdOth */{1467,-1,TabUnk,ActLstOth ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,Pwd_UpdateOtherPwd ,Acc_ShowFormChgOtherUsrAccount ,NULL},
|
||||
/* ActChgPwdStd */{1468,-1,TabUnk,ActLstStd ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,Pwd_UpdateOtherPwd ,Acc_ShowFormChgOtherUsrAccount ,NULL},
|
||||
/* ActChgPwdTch */{1469,-1,TabUnk,ActLstTch ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,Pwd_UpdateOtherPwd ,Acc_ShowFormChgOtherUsrAccount ,NULL},
|
||||
|
||||
/* ActFrmMaiOth */{1475,-1,TabUnk,ActLstOth ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mai_ShowFormOthEmail ,NULL},
|
||||
/* ActFrmMaiStd */{1476,-1,TabUnk,ActLstStd ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mai_ShowFormOthEmail ,NULL},
|
||||
/* ActFrmMaiTch */{1477,-1,TabUnk,ActLstTch ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mai_ShowFormOthEmail ,NULL},
|
||||
/* ActRemMaiOth */{1478,-1,TabUnk,ActLstOth ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mai_RemoveOtherUsrEmail ,NULL},
|
||||
/* ActRemMaiStd */{1479,-1,TabUnk,ActLstStd ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mai_RemoveOtherUsrEmail ,NULL},
|
||||
/* ActRemMaiTch */{1480,-1,TabUnk,ActLstTch ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mai_RemoveOtherUsrEmail ,NULL},
|
||||
|
@ -3124,8 +3128,8 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
/* ActRemID_Me */{1147,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ID_RemoveMyUsrID ,NULL},
|
||||
/* ActNewIDMe */{1148,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ID_NewMyUsrID ,NULL},
|
||||
|
||||
/* ActRemOldNic */{1089,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Nck_RemoveNick ,NULL},
|
||||
/* ActChgNic */{ 37,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Nck_UpdateNick ,NULL},
|
||||
/* ActRemOldNicMe */{1089,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Nck_RemoveMyNick ,NULL},
|
||||
/* ActChgNicMe */{ 37,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Nck_UpdateMyNick ,NULL},
|
||||
|
||||
/* ActRemMaiMe */{1090,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mai_RemoveMyUsrEmail ,NULL},
|
||||
/* ActNewMaiMe */{1088,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,May_NewMyUsrEmail ,NULL},
|
||||
|
@ -3221,7 +3225,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
|
|||
ActFrmChgMyPwd, // #34
|
||||
ActChgPwd, // #35
|
||||
ActFrmMyAcc, // #36
|
||||
ActChgNic, // #37
|
||||
ActChgNicMe, // #37
|
||||
-1, // #38 (obsolete action)
|
||||
-1, // #39 (obsolete action)
|
||||
-1, // #40 (obsolete action)
|
||||
|
@ -4273,7 +4277,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
|
|||
ActReqDatSeeMrkCrs, // #1086
|
||||
ActReqDatSeeMrkGrp, // #1087
|
||||
ActNewMaiMe, // #1088
|
||||
ActRemOldNic, // #1089
|
||||
ActRemOldNicMe, // #1089
|
||||
ActRemMaiMe, // #1090
|
||||
ActCnfMai, // #1091
|
||||
ActChgIco, // #1092
|
||||
|
@ -4631,9 +4635,9 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
|
|||
ActCreOth, // #1444
|
||||
ActCreStd, // #1445
|
||||
ActCreTch, // #1446
|
||||
ActFrmIDsOth, // #1447
|
||||
ActFrmIDsStd, // #1448
|
||||
ActFrmIDsTch, // #1449
|
||||
-1, // #1447 (obsolete action)
|
||||
-1, // #1448 (obsolete action)
|
||||
-1, // #1449 (obsolete action)
|
||||
ActRemID_Oth, // #1450
|
||||
ActRemID_Std, // #1451
|
||||
ActRemID_Tch, // #1452
|
||||
|
@ -4648,9 +4652,9 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
|
|||
ActRemMe_Tch, // #1461
|
||||
ActRemStdCrs, // #1462
|
||||
ActRemTchCrs, // #1463
|
||||
ActFrmPwdOth, // #1464
|
||||
ActFrmPwdStd, // #1465
|
||||
ActFrmPwdTch, // #1466
|
||||
-1, // #1464 (obsolete action)
|
||||
-1, // #1465 (obsolete action)
|
||||
-1, // #1466 (obsolete action)
|
||||
ActChgPwdOth, // #1467
|
||||
ActChgPwdStd, // #1468
|
||||
ActChgPwdTch, // #1469
|
||||
|
@ -4659,9 +4663,9 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
|
|||
ActReqRemNot, // #1472
|
||||
ActSeeLstMyAtt, // #1473
|
||||
ActPrnLstMyAtt, // #1474
|
||||
ActFrmMaiOth, // #1475
|
||||
ActFrmMaiStd, // #1476
|
||||
ActFrmMaiTch, // #1477
|
||||
-1, // #1475 (obsolete action)
|
||||
-1, // #1476 (obsolete action)
|
||||
-1, // #1477 (obsolete action)
|
||||
ActRemMaiOth, // #1478
|
||||
ActRemMaiStd, // #1479
|
||||
ActRemMaiTch, // #1480
|
||||
|
@ -4919,6 +4923,15 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
|
|||
ActReqDatAssPrj, // #1732
|
||||
ActChgDatAssPrj, // #1733
|
||||
ActDowAssPrj, // #1734
|
||||
ActFrmAccOth, // #1735
|
||||
ActFrmAccStd, // #1736
|
||||
ActFrmAccTch, // #1737
|
||||
ActRemOldNicOth, // #1738
|
||||
ActRemOldNicStd, // #1739
|
||||
ActRemOldNicTch, // #1740
|
||||
ActChgNicOth, // #1741
|
||||
ActChgNicStd, // #1742
|
||||
ActChgNicTch, // #1743
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -62,7 +62,7 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
|
|||
|
||||
#define Act_NUM_ACTIONS (1 + 9 + 43 + 17 + 47 + 33 + 24 + 115 + 157 + 437 + 165 + 172 + 42 + 14 + 76)
|
||||
|
||||
#define Act_MAX_ACTION_COD 1734
|
||||
#define Act_MAX_ACTION_COD 1743
|
||||
|
||||
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13
|
||||
|
||||
|
@ -1223,24 +1223,26 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
|
|||
#define ActCnfID_Std (ActRemOldBrf + 128)
|
||||
#define ActCnfID_Tch (ActRemOldBrf + 129)
|
||||
|
||||
#define ActFrmIDsOth (ActRemOldBrf + 130)
|
||||
#define ActFrmIDsStd (ActRemOldBrf + 131)
|
||||
#define ActFrmIDsTch (ActRemOldBrf + 132)
|
||||
#define ActRemID_Oth (ActRemOldBrf + 133)
|
||||
#define ActRemID_Std (ActRemOldBrf + 134)
|
||||
#define ActRemID_Tch (ActRemOldBrf + 135)
|
||||
#define ActNewID_Oth (ActRemOldBrf + 136)
|
||||
#define ActNewID_Std (ActRemOldBrf + 137)
|
||||
#define ActNewID_Tch (ActRemOldBrf + 138)
|
||||
#define ActFrmPwdOth (ActRemOldBrf + 139)
|
||||
#define ActFrmPwdStd (ActRemOldBrf + 140)
|
||||
#define ActFrmPwdTch (ActRemOldBrf + 141)
|
||||
#define ActChgPwdOth (ActRemOldBrf + 142)
|
||||
#define ActChgPwdStd (ActRemOldBrf + 143)
|
||||
#define ActChgPwdTch (ActRemOldBrf + 144)
|
||||
#define ActFrmMaiOth (ActRemOldBrf + 145)
|
||||
#define ActFrmMaiStd (ActRemOldBrf + 146)
|
||||
#define ActFrmMaiTch (ActRemOldBrf + 147)
|
||||
#define ActFrmAccOth (ActRemOldBrf + 130)
|
||||
#define ActFrmAccStd (ActRemOldBrf + 131)
|
||||
#define ActFrmAccTch (ActRemOldBrf + 132)
|
||||
|
||||
#define ActRemOldNicOth (ActRemOldBrf + 133)
|
||||
#define ActRemOldNicStd (ActRemOldBrf + 134)
|
||||
#define ActRemOldNicTch (ActRemOldBrf + 135)
|
||||
#define ActChgNicOth (ActRemOldBrf + 136)
|
||||
#define ActChgNicStd (ActRemOldBrf + 137)
|
||||
#define ActChgNicTch (ActRemOldBrf + 138)
|
||||
|
||||
#define ActRemID_Oth (ActRemOldBrf + 139)
|
||||
#define ActRemID_Std (ActRemOldBrf + 140)
|
||||
#define ActRemID_Tch (ActRemOldBrf + 141)
|
||||
#define ActNewID_Oth (ActRemOldBrf + 142)
|
||||
#define ActNewID_Std (ActRemOldBrf + 143)
|
||||
#define ActNewID_Tch (ActRemOldBrf + 144)
|
||||
#define ActChgPwdOth (ActRemOldBrf + 145)
|
||||
#define ActChgPwdStd (ActRemOldBrf + 146)
|
||||
#define ActChgPwdTch (ActRemOldBrf + 147)
|
||||
#define ActRemMaiOth (ActRemOldBrf + 148)
|
||||
#define ActRemMaiStd (ActRemOldBrf + 149)
|
||||
#define ActRemMaiTch (ActRemOldBrf + 150)
|
||||
|
@ -1558,8 +1560,8 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
|
|||
#define ActCreUsrAcc (ActSeeMyUsgRep + 29)
|
||||
#define ActRemID_Me (ActSeeMyUsgRep + 30)
|
||||
#define ActNewIDMe (ActSeeMyUsgRep + 31)
|
||||
#define ActRemOldNic (ActSeeMyUsgRep + 32)
|
||||
#define ActChgNic (ActSeeMyUsgRep + 33)
|
||||
#define ActRemOldNicMe (ActSeeMyUsgRep + 32)
|
||||
#define ActChgNicMe (ActSeeMyUsgRep + 33)
|
||||
#define ActRemMaiMe (ActSeeMyUsgRep + 34)
|
||||
#define ActNewMaiMe (ActSeeMyUsgRep + 35)
|
||||
#define ActCnfMai (ActSeeMyUsgRep + 36)
|
||||
|
|
16
swad_alert.c
16
swad_alert.c
|
@ -63,6 +63,17 @@ static const char *Ale_AlertIcons[Ale_NUM_ALERT_TYPES] =
|
|||
/***************************** Private prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************** Reset alert ********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Ale_ResetAlert (void)
|
||||
{
|
||||
Gbl.Alert.Type = Ale_NONE; // Reset alert
|
||||
Gbl.Alert.Section = NULL;
|
||||
Gbl.Alert.Txt[0] = '\0';
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Show a write-pending alert **************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -76,8 +87,7 @@ void Ale_ShowPendingAlert (void)
|
|||
/***** Show alert *****/
|
||||
Ale_ShowAlert (Gbl.Alert.Type,Gbl.Alert.Txt);
|
||||
|
||||
// Do not be tempted to restore the value of Gbl.Alert.Type to Ale_NONE here,
|
||||
// since it can still be used after calling this function.
|
||||
Ale_ResetAlert ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -89,6 +99,8 @@ void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *Txt)
|
|||
if (AlertType != Ale_NONE)
|
||||
Ale_ShowAlertAndButton (AlertType,Txt,
|
||||
ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL);
|
||||
|
||||
Ale_ResetAlert ();
|
||||
}
|
||||
|
||||
void Ale_ShowAlertAndButton (Ale_AlertType_t AlertType,const char *Txt,
|
||||
|
|
|
@ -58,6 +58,8 @@ typedef enum
|
|||
/****************************** Public prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Ale_ResetAlert (void);
|
||||
|
||||
void Ale_ShowPendingAlert (void);
|
||||
void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *Txt);
|
||||
void Ale_ShowAlertAndButton (Ale_AlertType_t AlertType,const char *Txt,
|
||||
|
|
|
@ -355,10 +355,32 @@ En OpenSWAD:
|
|||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.4 (2018-10-15)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.5 (2018-10-16)"
|
||||
#define CSS_FILE "swad18.4.css"
|
||||
#define JS_FILE "swad17.17.1.js"
|
||||
/*
|
||||
Version 18.5: Oct 16, 2018 Changes in management of other users. (235292 lines)
|
||||
19 changes necessary in database:
|
||||
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1735','es','N','Administrar cuenta otro');
|
||||
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1736','es','N','Administrar cuenta estudiante');
|
||||
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1737','es','N','Administrar cuenta profesor');
|
||||
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1738','es','N','Eliminar apodo otro');
|
||||
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1739','es','N','Eliminar apodo estudiante');
|
||||
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1740','es','N','Eliminar apodo profesor');
|
||||
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1741','es','N','Cambiar apodo otro');
|
||||
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1742','es','N','Cambiar apodo estudiante');
|
||||
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1743','es','N','Cambiar apodo profesor');
|
||||
UPDATE actions SET Txt='Cambiar mi apodo' WHERE ActCod='37' AND Language='es';
|
||||
UPDATE actions SET Obsolete='Y' WHERE ActCod='1464';
|
||||
UPDATE actions SET Obsolete='Y' WHERE ActCod='1465';
|
||||
UPDATE actions SET Obsolete='Y' WHERE ActCod='1466';
|
||||
UPDATE actions SET Obsolete='Y' WHERE ActCod='1464';
|
||||
UPDATE actions SET Obsolete='Y' WHERE ActCod='1465';
|
||||
UPDATE actions SET Obsolete='Y' WHERE ActCod='1466';
|
||||
UPDATE actions SET Obsolete='Y' WHERE ActCod='1447';
|
||||
UPDATE actions SET Obsolete='Y' WHERE ActCod='1448';
|
||||
UPDATE actions SET Obsolete='Y' WHERE ActCod='1449';
|
||||
|
||||
Version 18.4: Oct 15, 2018 Changes in user's account and management of other users. (235134 lines)
|
||||
Version 18.3.10: Oct 11, 2018 Fixed bug in text of menu options. (235007 lines)
|
||||
Version 18.3.9: Oct 11, 2018 Code refactoring related with checking if I am the logged user. (235046 lines)
|
||||
|
|
|
@ -3340,19 +3340,6 @@ static void Enr_AskIfRegRemUsr (struct ListUsrCods *ListUsrCods,Rol_Role_t Role)
|
|||
|
||||
static void Enr_ShowFormToEditOtherUsr (void)
|
||||
{
|
||||
|
||||
if (Usr_ICanEditOtherUsr (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
/***** Buttons for edition *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
||||
|
||||
Pwd_PutLinkToChangeOtherUsrPassword (); // Put link (form) to change user's password
|
||||
Mai_PutLinkToChangeOtherUsrEmails (); // Put link (form) to change user's emails
|
||||
ID_PutLinkToChangeUsrIDs (); // Put link (form) to change user's IDs
|
||||
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
|
||||
/***** User's record *****/
|
||||
Rec_ShowSharedUsrRecord (Rec_SHA_OTHER_EXISTING_USR_FORM,
|
||||
&Gbl.Usrs.Other.UsrDat,NULL);
|
||||
|
|
|
@ -122,8 +122,7 @@ void Gbl_InitializeGlobals (void)
|
|||
Gbl.Form.Num = -1; // Number of form. It's increased by 1 at the begin of each form
|
||||
Gbl.Form.Inside = false; // Set to true inside a form to avoid nested forms
|
||||
|
||||
Gbl.Alert.Type = Ale_NONE; // Used to show alert in a posteriori function
|
||||
Gbl.Alert.Section = NULL; // Where to display the alert
|
||||
Ale_ResetAlert ();
|
||||
|
||||
Gbl.DB.DatabaseIsOpen = false;
|
||||
Gbl.DB.LockedTables = false;
|
||||
|
|
66
swad_mail.c
66
swad_mail.c
|
@ -54,8 +54,6 @@ extern struct Globals Gbl;
|
|||
|
||||
#define Mai_LENGTH_EMAIL_CONFIRM_KEY Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64
|
||||
|
||||
#define Mai_EMAIL_SECTION_ID "email_section"
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Private types *******************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -64,6 +62,8 @@ extern struct Globals Gbl;
|
|||
/***************************** Private variables *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
const char *Mai_EMAIL_SECTION_ID = "email_section";
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Private prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -1138,45 +1138,6 @@ long Mai_GetUsrCodFromEmail (const char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1])
|
|||
return UsrCod;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********** Put a link to the action used to change user's emails ************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Mai_PutLinkToChangeOtherUsrEmails (void)
|
||||
{
|
||||
extern const char *Txt_Change_email;
|
||||
Act_Action_t NextAction;
|
||||
bool ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
/***** Link for changing the password *****/
|
||||
if (ItsMe)
|
||||
Lay_PutContextualLink (ActFrmMyAcc,NULL,NULL,
|
||||
"msg64x64.gif",
|
||||
Txt_Change_email,Txt_Change_email,
|
||||
NULL);
|
||||
else // Not me
|
||||
{
|
||||
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActFrmMaiStd;
|
||||
break;
|
||||
case Rol_NET:
|
||||
case Rol_TCH:
|
||||
NextAction = ActFrmMaiTch;
|
||||
break;
|
||||
default: // Guest, user or admin
|
||||
NextAction = ActFrmMaiOth;
|
||||
break;
|
||||
}
|
||||
Lay_PutContextualLink (NextAction,NULL,
|
||||
Usr_PutParamOtherUsrCodEncrypted,
|
||||
"msg64x64.gif",
|
||||
Txt_Change_email,Txt_Change_email,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********** Show form to the change the email of another user ***************/
|
||||
/*****************************************************************************/
|
||||
|
@ -1248,15 +1209,27 @@ void Mai_ShowFormChangeMyEmail (bool IMustFillEmail,bool IShouldConfirmEmail)
|
|||
|
||||
void Mai_ShowFormChangeOtherUsrEmail (void)
|
||||
{
|
||||
extern const char *Hlp_PROFILE_Account;
|
||||
extern const char *Txt_Email;
|
||||
char StrRecordWidth[10 + 1];
|
||||
|
||||
/***** Start section *****/
|
||||
Lay_StartSection (Mai_EMAIL_SECTION_ID);
|
||||
|
||||
/***** Start box *****/
|
||||
sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH);
|
||||
Box_StartBox (StrRecordWidth,Txt_Email,NULL,
|
||||
Hlp_PROFILE_Account,Box_NOT_CLOSABLE);
|
||||
|
||||
/***** Show form to change email *****/
|
||||
Mai_ShowFormChangeUsrEmail (&Gbl.Usrs.Other.UsrDat,
|
||||
false, // ItsMe
|
||||
false, // IMustFillEmail
|
||||
false); // IShouldConfirmEmail
|
||||
|
||||
/***** End box *****/
|
||||
Box_EndBox ();
|
||||
|
||||
/***** End section *****/
|
||||
Lay_EndSection ();
|
||||
}
|
||||
|
@ -1364,7 +1337,8 @@ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe,
|
|||
Act_StartFormAnchor (NextAction,Mai_EMAIL_SECTION_ID);
|
||||
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"<input type=\"hidden\" name=\"Email\" value=\"%s\" />",
|
||||
fprintf (Gbl.F.Out,"<input type=\"hidden\" name=\"Email\""
|
||||
" value=\"%s\" />",
|
||||
row[0]);
|
||||
Ico_PutIconRemove ();
|
||||
Act_EndForm ();
|
||||
|
@ -1421,10 +1395,10 @@ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe,
|
|||
|
||||
/***** Form to enter new email *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"RIGHT_TOP\">"
|
||||
"<td class=\"REC_C1_BOT RIGHT_TOP\">"
|
||||
"<label for=\"NewEmail\" class=\"%s\">%s:</label>"
|
||||
"</td>"
|
||||
"<td class=\"LEFT_TOP DAT\">",
|
||||
"<td class=\"REC_C2_BOT LEFT_TOP DAT\">",
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
NumEmails ? Txt_New_email : // A new email
|
||||
Txt_Email); // The first email
|
||||
|
@ -1491,7 +1465,7 @@ void Mai_RemoveOtherUsrEmail (void)
|
|||
Mai_RemoveEmail (&Gbl.Usrs.Other.UsrDat);
|
||||
|
||||
/***** Show form again *****/
|
||||
Mai_ShowFormOthEmail ();
|
||||
Acc_ShowFormChgOtherUsrAccount ();
|
||||
}
|
||||
else // User not found
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
|
@ -1577,7 +1551,7 @@ void Mai_NewOtherUsrEmail (void)
|
|||
Mai_NewUsrEmail (&Gbl.Usrs.Other.UsrDat,ItsMe);
|
||||
|
||||
/***** Show form again *****/
|
||||
Mai_ShowFormOthEmail ();
|
||||
Acc_ShowFormChgOtherUsrAccount ();
|
||||
}
|
||||
else // User not found
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
|
|
|
@ -77,7 +77,6 @@ bool Mai_CheckIfEmailIsValid (const char *Email);
|
|||
bool Mai_GetEmailFromUsrCod (struct UsrData *UsrDat);
|
||||
long Mai_GetUsrCodFromEmail (const char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]);
|
||||
|
||||
void Mai_PutLinkToChangeOtherUsrEmails (void);
|
||||
void Mai_ShowFormOthEmail (void);
|
||||
void Mai_ShowFormChangeMyEmail (bool IMustFillEmail,bool IShouldConfirmEmail);
|
||||
void Mai_ShowFormChangeOtherUsrEmail (void);
|
||||
|
|
244
swad_nickname.c
244
swad_nickname.c
|
@ -46,8 +46,6 @@ extern struct Globals Gbl;
|
|||
/***************************** Private constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Nck_NICKNAME_SECTION_ID "nickname_section"
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Private types *******************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -56,13 +54,18 @@ extern struct Globals Gbl;
|
|||
/***************************** Private variables *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
const char *Nck_NICKNAME_SECTION_ID = "nickname_section";
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Private prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Nck_ShowFormChangeUsrNickname (bool IMustFillNickname);
|
||||
static void Nck_ShowFormChangeUsrNickname (const struct UsrData *UsrDat,bool ItsMe,
|
||||
bool IMustFillNickname);
|
||||
|
||||
static void Nck_RemoveNicknameFromDB (const char *Nickname);
|
||||
static void Nck_RemoveNicknameFromDB (long UsrCod,const char *Nickname);
|
||||
|
||||
static void Nck_UpdateUsrNick (struct UsrData *UsrDat);
|
||||
|
||||
/*****************************************************************************/
|
||||
/********* Check whether a nickname (with initial arroba) if valid ***********/
|
||||
|
@ -190,25 +193,28 @@ long Nck_GetUsrCodFromNickname (const char *Nickname)
|
|||
|
||||
void Nck_ShowFormChangeMyNickname (bool IMustFillNickname)
|
||||
{
|
||||
Nck_ShowFormChangeUsrNickname (IMustFillNickname);
|
||||
Nck_ShowFormChangeUsrNickname (&Gbl.Usrs.Me.UsrDat,
|
||||
true, // ItsMe
|
||||
IMustFillNickname);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Show form to change my nickname *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
// Not yet used
|
||||
|
||||
void Nck_ShowFormChangeOtherUsrNickname (void)
|
||||
{
|
||||
Nck_ShowFormChangeUsrNickname (false); // IMustFillNickname
|
||||
Nck_ShowFormChangeUsrNickname (&Gbl.Usrs.Other.UsrDat,
|
||||
false, // ItsMe
|
||||
false); // IMustFillNickname
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Show form to change my nickname *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Nck_ShowFormChangeUsrNickname (bool IMustFillNickname)
|
||||
static void Nck_ShowFormChangeUsrNickname (const struct UsrData *UsrDat,bool ItsMe,
|
||||
bool IMustFillNickname)
|
||||
{
|
||||
extern const char *Hlp_PROFILE_Account;
|
||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||
|
@ -227,6 +233,7 @@ static void Nck_ShowFormChangeUsrNickname (bool IMustFillNickname)
|
|||
char StrRecordWidth[10 + 1];
|
||||
unsigned NumNicks;
|
||||
unsigned NumNick;
|
||||
Act_Action_t NextAction;
|
||||
|
||||
/***** Start section *****/
|
||||
Lay_StartSection (Nck_NICKNAME_SECTION_ID);
|
||||
|
@ -235,7 +242,7 @@ static void Nck_ShowFormChangeUsrNickname (bool IMustFillNickname)
|
|||
sprintf (Query,"SELECT Nickname FROM usr_nicknames"
|
||||
" WHERE UsrCod=%ld"
|
||||
" ORDER BY CreatTime DESC",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
UsrDat->UsrCod);
|
||||
NumNicks = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get nicknames of a user");
|
||||
|
||||
/***** Start box *****/
|
||||
|
@ -255,7 +262,7 @@ static void Nck_ShowFormChangeUsrNickname (bool IMustFillNickname)
|
|||
/***** Start table *****/
|
||||
Tbl_StartTableWide (2);
|
||||
|
||||
/***** List my nicknames *****/
|
||||
/***** List nicknames *****/
|
||||
for (NumNick = 1;
|
||||
NumNick <= NumNicks;
|
||||
NumNick++)
|
||||
|
@ -290,7 +297,26 @@ static void Nck_ShowFormChangeUsrNickname (bool IMustFillNickname)
|
|||
fprintf (Gbl.F.Out,"<td class=\"REC_C2_BOT LEFT_TOP DAT\">");
|
||||
|
||||
/* Form to remove old nickname */
|
||||
Act_StartFormAnchor (ActRemOldNic,Nck_NICKNAME_SECTION_ID);
|
||||
if (ItsMe)
|
||||
Act_StartFormAnchor (ActRemOldNicMe,Nck_NICKNAME_SECTION_ID);
|
||||
else
|
||||
{
|
||||
switch (UsrDat->Roles.InCurrentCrs.Role)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActRemOldNicStd;
|
||||
break;
|
||||
case Rol_NET:
|
||||
case Rol_TCH:
|
||||
NextAction = ActRemOldNicTch;
|
||||
break;
|
||||
default: // Guest, user or admin
|
||||
NextAction = ActRemOldNicOth;
|
||||
break;
|
||||
}
|
||||
Act_StartFormAnchor (NextAction,Nck_NICKNAME_SECTION_ID);
|
||||
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"<input type=\"hidden\" name=\"Nick\""
|
||||
" value=\"%s\" />",
|
||||
row[0]);
|
||||
|
@ -302,7 +328,7 @@ static void Nck_ShowFormChangeUsrNickname (bool IMustFillNickname)
|
|||
fprintf (Gbl.F.Out,"@%s",row[0]);
|
||||
|
||||
/* Link to QR code */
|
||||
if (NumNick == 1 && Gbl.Usrs.Me.UsrDat.Nickname[0])
|
||||
if (NumNick == 1 && UsrDat->Nickname[0])
|
||||
Lay_PutContextualLink (ActPrnUsrQR,NULL,Usr_PutParamMyUsrCodEncrypted,
|
||||
"qr64x64.gif",
|
||||
Txt_QR_code,NULL,
|
||||
|
@ -313,7 +339,26 @@ static void Nck_ShowFormChangeUsrNickname (bool IMustFillNickname)
|
|||
if (NumNick > 1)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<br />");
|
||||
Act_StartFormAnchor (ActChgNic,Nck_NICKNAME_SECTION_ID);
|
||||
if (ItsMe)
|
||||
Act_StartFormAnchor (ActChgNicMe,Nck_NICKNAME_SECTION_ID);
|
||||
else
|
||||
{
|
||||
switch (UsrDat->Roles.InCurrentCrs.Role)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActChgNicStd;
|
||||
break;
|
||||
case Rol_NET:
|
||||
case Rol_TCH:
|
||||
NextAction = ActChgNicTch;
|
||||
break;
|
||||
default: // Guest, user or admin
|
||||
NextAction = ActChgNicOth;
|
||||
break;
|
||||
}
|
||||
Act_StartFormAnchor (NextAction,Nck_NICKNAME_SECTION_ID);
|
||||
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"<input type=\"hidden\" name=\"NewNick\""
|
||||
" value=\"@%s\" />",
|
||||
row[0]); // Nickname
|
||||
|
@ -336,14 +381,33 @@ static void Nck_ShowFormChangeUsrNickname (bool IMustFillNickname)
|
|||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
NumNicks ? Txt_New_nickname : // A new nickname
|
||||
Txt_Nickname); // The first nickname
|
||||
Act_StartFormAnchor (ActChgNic,Nck_NICKNAME_SECTION_ID);
|
||||
if (ItsMe)
|
||||
Act_StartFormAnchor (ActChgNicMe,Nck_NICKNAME_SECTION_ID);
|
||||
else
|
||||
{
|
||||
switch (UsrDat->Roles.InCurrentCrs.Role)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActChgNicStd;
|
||||
break;
|
||||
case Rol_NET:
|
||||
case Rol_TCH:
|
||||
NextAction = ActChgNicTch;
|
||||
break;
|
||||
default: // Guest, user or admin
|
||||
NextAction = ActChgNicOth;
|
||||
break;
|
||||
}
|
||||
Act_StartFormAnchor (NextAction,Nck_NICKNAME_SECTION_ID);
|
||||
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"<input type=\"text\" id=\"NewNick\" name=\"NewNick\""
|
||||
" size=\"18\" maxlength=\"%u\" value=\"@%s\" />"
|
||||
"<br />",
|
||||
1 + Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA,
|
||||
Gbl.Usrs.Me.UsrDat.Nickname);
|
||||
Btn_PutCreateButtonInline (NumNicks ? Txt_Change_nickname : // I already have a nickname
|
||||
Txt_Save); // I have no nickname yet);
|
||||
Txt_Save); // I have no nickname yet);
|
||||
Act_EndForm ();
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
"</tr>");
|
||||
|
@ -356,22 +420,23 @@ static void Nck_ShowFormChangeUsrNickname (bool IMustFillNickname)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Remove nickname *****************************/
|
||||
/***************************** Remove my nickname ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Nck_RemoveNick (void)
|
||||
void Nck_RemoveMyNick (void)
|
||||
{
|
||||
extern const char *Txt_Nickname_X_removed;
|
||||
extern const char *Txt_You_can_not_delete_your_current_nickname;
|
||||
char NicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1];
|
||||
|
||||
/***** Get new nickname from form *****/
|
||||
Par_GetParToText ("Nick",NicknameWithoutArroba,Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
/***** Get nickname from form *****/
|
||||
Par_GetParToText ("Nick",NicknameWithoutArroba,
|
||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
|
||||
if (strcasecmp (NicknameWithoutArroba,Gbl.Usrs.Me.UsrDat.Nickname)) // Only if not my current nickname
|
||||
{
|
||||
/***** Remove one of my old nicknames *****/
|
||||
Nck_RemoveNicknameFromDB (NicknameWithoutArroba);
|
||||
Nck_RemoveNicknameFromDB (Gbl.Usrs.Me.UsrDat.UsrCod,NicknameWithoutArroba);
|
||||
|
||||
/***** Show message *****/
|
||||
Gbl.Alert.Type = Ale_SUCCESS;
|
||||
|
@ -390,36 +455,113 @@ void Nck_RemoveNick (void)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Remove an old nickname from database ********************/
|
||||
/********************* Remove another user's nickname ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Nck_RemoveNicknameFromDB (const char *Nickname)
|
||||
void Nck_RemoveOtherUsrNick (void)
|
||||
{
|
||||
char Query[256];
|
||||
extern const char *Txt_Nickname_X_removed;
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
char NicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1];
|
||||
|
||||
/***** Remove an old nickname *****/
|
||||
sprintf (Query,"DELETE FROM usr_nicknames"
|
||||
" WHERE UsrCod=%ld AND Nickname='%s'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,Nickname);
|
||||
DB_QueryREPLACE (Query,"can not remove an old nickname");
|
||||
/***** Get user whose nick must be removed *****/
|
||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
{
|
||||
if (Usr_ICanEditOtherUsr (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
/***** Get nickname from form *****/
|
||||
Par_GetParToText ("Nick",NicknameWithoutArroba,
|
||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
|
||||
/***** Remove one of the old nicknames *****/
|
||||
Nck_RemoveNicknameFromDB (Gbl.Usrs.Other.UsrDat.UsrCod,NicknameWithoutArroba);
|
||||
|
||||
/***** Show message *****/
|
||||
Gbl.Alert.Type = Ale_SUCCESS;
|
||||
Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID;
|
||||
sprintf (Gbl.Alert.Txt,Txt_Nickname_X_removed,NicknameWithoutArroba);
|
||||
|
||||
/***** Show user's account again *****/
|
||||
Acc_ShowFormChgOtherUsrAccount ();
|
||||
}
|
||||
else
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
else // User not found
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Update nickname *****************************/
|
||||
/********************** Remove a nickname from database **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Nck_UpdateNick (void)
|
||||
static void Nck_RemoveNicknameFromDB (long UsrCod,const char *Nickname)
|
||||
{
|
||||
char Query[256];
|
||||
|
||||
/***** Remove a nickname *****/
|
||||
sprintf (Query,"DELETE FROM usr_nicknames"
|
||||
" WHERE UsrCod=%ld AND Nickname='%s'",
|
||||
UsrCod,Nickname);
|
||||
DB_QueryREPLACE (Query,"can not remove a nickname");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Update my nickname ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Nck_UpdateMyNick (void)
|
||||
{
|
||||
/***** Update my nickname *****/
|
||||
Nck_UpdateUsrNick (&Gbl.Usrs.Me.UsrDat);
|
||||
|
||||
/***** Show my account again *****/
|
||||
Acc_ShowFormChgMyAccount ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Update another user's nickname **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Nck_UpdateOtherUsrNick (void)
|
||||
{
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
|
||||
/***** Get user whose nick must be changed *****/
|
||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
{
|
||||
if (Usr_ICanEditOtherUsr (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
/***** Update my nickname *****/
|
||||
Nck_UpdateUsrNick (&Gbl.Usrs.Other.UsrDat);
|
||||
|
||||
/***** Show user's account again *****/
|
||||
Acc_ShowFormChgOtherUsrAccount ();
|
||||
}
|
||||
else
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
else // User not found
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************************** Update user's nickname **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Nck_UpdateUsrNick (struct UsrData *UsrDat)
|
||||
{
|
||||
extern const char *Txt_The_nickname_X_matches_the_one_you_had_previously_registered;
|
||||
extern const char *Txt_The_nickname_X_had_been_registered_by_another_user;
|
||||
extern const char *Txt_Your_nickname_X_has_been_registered_successfully;
|
||||
extern const char *Txt_The_nickname_X_has_been_registered_successfully;
|
||||
extern const char *Txt_The_nickname_entered_X_is_not_valid_;
|
||||
char Query[1024];
|
||||
char Query[128 + Nck_MAX_BYTES_NICKNAME_FROM_FORM];
|
||||
char NewNicknameWithArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
||||
char NewNicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
||||
|
||||
/***** Get new nickname from form *****/
|
||||
Par_GetParToText ("NewNick",NewNicknameWithArroba,Nck_MAX_BYTES_NICKNAME_FROM_FORM);
|
||||
Par_GetParToText ("NewNick",NewNicknameWithArroba,
|
||||
Nck_MAX_BYTES_NICKNAME_FROM_FORM);
|
||||
if (Nck_CheckIfNickWithArrobaIsValid (NewNicknameWithArroba)) // If new nickname is valid
|
||||
{
|
||||
/***** Remove arrobas at the beginning *****/
|
||||
|
@ -428,26 +570,26 @@ void Nck_UpdateNick (void)
|
|||
Str_RemoveLeadingArrobas (NewNicknameWithoutArroba);
|
||||
|
||||
/***** Check if new nickname exists in database *****/
|
||||
if (!strcmp (Gbl.Usrs.Me.UsrDat.Nickname,NewNicknameWithoutArroba)) // My nickname match exactly the new nickname
|
||||
if (!strcmp (UsrDat->Nickname,NewNicknameWithoutArroba)) // User's nickname match exactly the new nickname
|
||||
{
|
||||
Gbl.Alert.Type = Ale_WARNING;
|
||||
Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID;
|
||||
sprintf (Gbl.Alert.Txt,Txt_The_nickname_X_matches_the_one_you_had_previously_registered,
|
||||
NewNicknameWithoutArroba);
|
||||
}
|
||||
else if (strcasecmp (Gbl.Usrs.Me.UsrDat.Nickname,NewNicknameWithoutArroba)) // My nickname does not match, not even case insensitive, the new nickname
|
||||
else if (strcasecmp (UsrDat->Nickname,NewNicknameWithoutArroba)) // User's nickname does not match, not even case insensitive, the new nickname
|
||||
{
|
||||
/***** Check if the new nickname matches any of my old nicknames *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_nicknames"
|
||||
" WHERE UsrCod=%ld AND Nickname='%s'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,NewNicknameWithoutArroba);
|
||||
UsrDat->UsrCod,NewNicknameWithoutArroba);
|
||||
if (!DB_QueryCOUNT (Query,"can not check if nickname already existed")) // No matches
|
||||
{
|
||||
/***** Check if the new nickname matches any of the nicknames of other users *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_nicknames"
|
||||
" WHERE Nickname='%s' AND UsrCod<>%ld",
|
||||
NewNicknameWithoutArroba,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (DB_QueryCOUNT (Query,"can not check if nickname already existed")) // A nickname of another user is the same that my nickname
|
||||
NewNicknameWithoutArroba,UsrDat->UsrCod);
|
||||
if (DB_QueryCOUNT (Query,"can not check if nickname already existed")) // A nickname of another user is the same that user's nickname
|
||||
{
|
||||
Gbl.Alert.Type = Ale_WARNING;
|
||||
Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID;
|
||||
|
@ -458,14 +600,15 @@ void Nck_UpdateNick (void)
|
|||
}
|
||||
if (Gbl.Alert.Type == Ale_NONE)
|
||||
{
|
||||
// Now we know the new nickname is not already in database and is diffent to the current one
|
||||
Nck_UpdateMyNick (NewNicknameWithoutArroba);
|
||||
Str_Copy (Gbl.Usrs.Me.UsrDat.Nickname,NewNicknameWithoutArroba,
|
||||
// Now we know the new nickname is not already in database
|
||||
// and is diffent to the current one
|
||||
Nck_UpdateNickInDB (UsrDat->UsrCod,NewNicknameWithoutArroba);
|
||||
Str_Copy (UsrDat->Nickname,NewNicknameWithoutArroba,
|
||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
|
||||
Gbl.Alert.Type = Ale_SUCCESS;
|
||||
Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID;
|
||||
sprintf (Gbl.Alert.Txt,Txt_Your_nickname_X_has_been_registered_successfully,
|
||||
Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID;
|
||||
sprintf (Gbl.Alert.Txt,Txt_The_nickname_X_has_been_registered_successfully,
|
||||
NewNicknameWithoutArroba);
|
||||
}
|
||||
}
|
||||
|
@ -478,24 +621,21 @@ void Nck_UpdateNick (void)
|
|||
Nck_MIN_CHARS_NICKNAME_WITHOUT_ARROBA,
|
||||
Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA);
|
||||
}
|
||||
|
||||
/***** Show my account again *****/
|
||||
Acc_ShowFormChgMyAccount ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************** Update my nickname in database ***********************/
|
||||
/******************* Update user's nickname in database **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Nck_UpdateMyNick (const char *NewNickname)
|
||||
void Nck_UpdateNickInDB (long UsrCod,const char *NewNickname)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
/***** Update my nickname in database *****/
|
||||
/***** Update user's nickname in database *****/
|
||||
sprintf (Query,"REPLACE INTO usr_nicknames"
|
||||
" (UsrCod,Nickname,CreatTime)"
|
||||
" VALUES"
|
||||
" (%ld,'%s',NOW())",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,NewNickname);
|
||||
DB_QueryREPLACE (Query,"can not update your nickname");
|
||||
UsrCod,NewNickname);
|
||||
DB_QueryREPLACE (Query,"can not update nickname");
|
||||
}
|
||||
|
|
|
@ -55,8 +55,12 @@ long Nck_GetUsrCodFromNickname (const char *Nickname);
|
|||
void Nck_ShowFormChangeMyNickname (bool IMustFillNickname);
|
||||
void Nck_ShowFormChangeOtherUsrNickname (void);
|
||||
|
||||
void Nck_RemoveNick (void);
|
||||
void Nck_UpdateNick (void);
|
||||
void Nck_UpdateMyNick (const char *NewNickname);
|
||||
void Nck_RemoveMyNick (void);
|
||||
void Nck_RemoveOtherUsrNick (void);
|
||||
|
||||
void Nck_UpdateMyNick (void);
|
||||
void Nck_UpdateOtherUsrNick (void);
|
||||
|
||||
void Nck_UpdateNickInDB (long UsrCod,const char *NewNickname);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -55,8 +55,6 @@ extern struct Globals Gbl;
|
|||
// and another user can not change his/her password to this
|
||||
#define Pwd_MAX_OTHER_USERS_USING_THE_SAME_PASSWORD 2
|
||||
|
||||
#define Pwd_PASSWORD_SECTION_ID "password_section"
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Private types *******************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -65,6 +63,8 @@ extern struct Globals Gbl;
|
|||
/***************************** Private variables *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
const char *Pwd_PASSWORD_SECTION_ID = "password_section";
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Private prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -500,7 +500,7 @@ void Pwd_SetMyPendingPassword (char PlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD +
|
|||
void Pwd_UpdateOtherPwd (void)
|
||||
{
|
||||
extern const char *Txt_You_have_not_written_twice_the_same_new_password;
|
||||
extern const char *Txt_The_X_password_has_been_changed_successfully;
|
||||
extern const char *Txt_The_password_has_been_changed_successfully;
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
char NewPlainPassword[2][Pwd_MAX_BYTES_PLAIN_PASSWORD + 1];
|
||||
char NewEncryptedPassword[Pwd_BYTES_ENCRYPTED_PASSWORD + 1];
|
||||
|
@ -535,8 +535,8 @@ void Pwd_UpdateOtherPwd (void)
|
|||
|
||||
Gbl.Alert.Type = Ale_SUCCESS;
|
||||
Gbl.Alert.Section = Pwd_PASSWORD_SECTION_ID;
|
||||
sprintf (Gbl.Alert.Txt,Txt_The_X_password_has_been_changed_successfully,
|
||||
Gbl.Usrs.Other.UsrDat.FullName);
|
||||
sprintf (Gbl.Alert.Txt,"%s",
|
||||
Txt_The_password_has_been_changed_successfully);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -849,7 +849,7 @@ void Pwd_PutFormToGetNewPasswordTwice (void)
|
|||
/********** Show form to the change of password of another user **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Pwd_ShowFormOthPwd (void)
|
||||
void Pwd_ShowFormChgOtherUsrPwd (void)
|
||||
{
|
||||
extern const char *Txt_Password;
|
||||
extern const char *Txt_Change_password;
|
||||
|
@ -865,14 +865,12 @@ void Pwd_ShowFormOthPwd (void)
|
|||
Box_StartBox (NULL,Txt_Password,NULL,
|
||||
NULL,Box_NOT_CLOSABLE);
|
||||
|
||||
/***** Show user's record *****/
|
||||
Rec_ShowSharedUsrRecord (Rec_SHA_RECORD_LIST,
|
||||
&Gbl.Usrs.Other.UsrDat,NULL);
|
||||
/***** Start section *****/
|
||||
Lay_StartSection (Pwd_PASSWORD_SECTION_ID);
|
||||
|
||||
/***** Show possible alert *****/
|
||||
Ale_ShowAlert (Gbl.Alert.Type,Gbl.Alert.Txt);
|
||||
if (Gbl.Alert.Section == (const char *) Pwd_PASSWORD_SECTION_ID)
|
||||
Ale_ShowAlert (Gbl.Alert.Type,Gbl.Alert.Txt);
|
||||
|
||||
/***** Form to change password *****/
|
||||
/* Start form */
|
||||
|
@ -893,7 +891,7 @@ void Pwd_ShowFormOthPwd (void)
|
|||
Usr_PutParamOtherUsrCodEncrypted ();
|
||||
|
||||
/* New password */
|
||||
Tbl_StartTableCenter (2);
|
||||
Tbl_StartTableWide (2);
|
||||
Pwd_PutFormToGetNewPasswordTwice ();
|
||||
Tbl_EndTable ();
|
||||
|
||||
|
@ -914,57 +912,6 @@ void Pwd_ShowFormOthPwd (void)
|
|||
Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********* Put a link to the action used to change user's password ***********/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Pwd_PutLinkToChangeMyPassword (void)
|
||||
{
|
||||
extern const char *Txt_Change_password;
|
||||
|
||||
/***** Link for changing the password *****/
|
||||
Lay_PutContextualLink (ActFrmChgMyPwd,NULL,NULL,
|
||||
"key64x64.gif",
|
||||
Txt_Change_password,Txt_Change_password,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********* Put a link to the action used to change user's password ***********/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Pwd_PutLinkToChangeOtherUsrPassword (void)
|
||||
{
|
||||
extern const char *Txt_Change_password;
|
||||
Act_Action_t NextAction;
|
||||
bool ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
/***** Link for changing the password *****/
|
||||
if (ItsMe)
|
||||
Pwd_PutLinkToChangeMyPassword ();
|
||||
else // Not me
|
||||
{
|
||||
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActFrmPwdStd;
|
||||
break;
|
||||
case Rol_NET:
|
||||
case Rol_TCH:
|
||||
NextAction = ActFrmPwdTch;
|
||||
break;
|
||||
default: // Guest, user or admin
|
||||
NextAction = ActFrmPwdOth;
|
||||
break;
|
||||
}
|
||||
Lay_PutContextualLink (NextAction,NULL,
|
||||
Usr_PutParamOtherUsrCodEncrypted,
|
||||
"key64x64.gif",
|
||||
Txt_Change_password,Txt_Change_password,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Ask for confirmation on dangerous actions *****************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -67,10 +67,7 @@ bool Pwd_FastCheckIfPasswordSeemsGood (const char *PlainPassword);
|
|||
void Pwd_ShowFormChgMyPwd (void);
|
||||
void Pwd_PutFormToGetNewPasswordOnce (void);
|
||||
void Pwd_PutFormToGetNewPasswordTwice (void);
|
||||
void Pwd_ShowFormOthPwd (void);
|
||||
|
||||
void Pwd_PutLinkToChangeMyPassword (void);
|
||||
void Pwd_PutLinkToChangeOtherUsrPassword (void);
|
||||
void Pwd_ShowFormChgOtherUsrPwd (void);
|
||||
|
||||
void Pwd_AskForConfirmationOnDangerousAction (void);
|
||||
bool Pwd_GetConfirmationOnDangerousAction (void);
|
||||
|
|
|
@ -164,7 +164,7 @@ bool Pho_ICanChangeOtherUsrPhoto (const struct UsrData *UsrDat)
|
|||
/********** Put a link to the action used to request user's photo ************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Pho_PutLinkToChangeOtherUsrPhoto (void)
|
||||
void Pho_PutIconToChangeUsrPhoto (void)
|
||||
{
|
||||
extern const char *Txt_Change_photo;
|
||||
extern const char *Txt_Upload_photo;
|
||||
|
|
|
@ -84,7 +84,7 @@ typedef enum
|
|||
/*****************************************************************************/
|
||||
|
||||
bool Pho_ICanChangeOtherUsrPhoto (const struct UsrData *UsrDat);
|
||||
void Pho_PutLinkToChangeOtherUsrPhoto (void);
|
||||
void Pho_PutIconToChangeUsrPhoto (void);
|
||||
void Pho_ReqMyPhoto (void);
|
||||
void Pho_SendPhotoUsr (void);
|
||||
void Pho_RecMyPhotoDetFaces (void);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <stdlib.h> // For calloc
|
||||
#include <string.h>
|
||||
|
||||
#include "swad_account.h"
|
||||
#include "swad_action.h"
|
||||
#include "swad_box.h"
|
||||
#include "swad_config.h"
|
||||
|
@ -2683,7 +2684,10 @@ static void Rec_PutIconsCommands (void)
|
|||
}
|
||||
|
||||
/***** Button to change user's photo *****/
|
||||
Pho_PutLinkToChangeOtherUsrPhoto ();
|
||||
Pho_PutIconToChangeUsrPhoto ();
|
||||
|
||||
/***** Button to change user's account *****/
|
||||
Acc_PutIconToChangeUsrAccount ();
|
||||
|
||||
/***** End container *****/
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
|
|
101
swad_text.c
101
swad_text.c
|
@ -4656,6 +4656,27 @@ const char *Txt_Centres_with_pending_degrees =
|
|||
"Centros com titulações pendentes";
|
||||
#endif
|
||||
|
||||
const char *Txt_Change_account =
|
||||
#if L==1
|
||||
"Canviar compte";
|
||||
#elif L==2
|
||||
"Benutzerkonto ändern";
|
||||
#elif L==3
|
||||
"Change account";
|
||||
#elif L==4
|
||||
"Cambiar cuenta";
|
||||
#elif L==5
|
||||
"Changer compte";
|
||||
#elif L==6
|
||||
"Cambiar cuenta"; // Okoteve traducción
|
||||
#elif L==7
|
||||
"Cambiare account";
|
||||
#elif L==8
|
||||
"Zmień konto";
|
||||
#elif L==9
|
||||
"Alterar conta";
|
||||
#endif
|
||||
|
||||
const char *Txt_Change_email =
|
||||
#if L==1
|
||||
"Canviar correu";
|
||||
|
@ -46914,6 +46935,36 @@ const char *Txt_The_new_logo_is_X = // Warning: it is very important to include
|
|||
"The new logo is <strong>%s</strong>."; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_The_nickname_X_has_been_registered_successfully = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==1
|
||||
"El apodo <strong>@%s</strong>"
|
||||
" se ha registrado correctamente."; // Necessita traduccio
|
||||
#elif L==2
|
||||
"The nickname <strong>@%s</strong>"
|
||||
" has been registered successfully."; // Need Übersetzung
|
||||
#elif L==3
|
||||
"The nickname <strong>@%s</strong>"
|
||||
" has been registered successfully.";
|
||||
#elif L==4
|
||||
"El apodo <strong>@%s</strong>"
|
||||
" se ha registrado correctamente.";
|
||||
#elif L==5
|
||||
"The nickname <strong>@%s</strong>"
|
||||
" has been registered successfully."; // Besoin de traduction
|
||||
#elif L==6
|
||||
"El apodo <strong>@%s</strong>"
|
||||
" se ha registrado correctamente."; // Okoteve traducción
|
||||
#elif L==7
|
||||
"Il nome utente <strong>@%s</strong>"
|
||||
" è stato registrato con successo.";
|
||||
#elif L==8
|
||||
"The nickname <strong>@%s</strong>"
|
||||
" has been registered successfully."; // Potrzebujesz tlumaczenie
|
||||
#elif L==9
|
||||
"The nickname <strong>@%s</strong>"
|
||||
" has been registered successfully."; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_The_nickname_entered_X_is_not_valid_ = // Warning: it is very important to include %s and two %u in the following sentences
|
||||
#if L==1
|
||||
"El apodo <strong>%s</strong> no es válido.<br />"
|
||||
|
@ -47436,25 +47487,25 @@ const char *Txt_The_password_must_be_at_least_X_characters = // Warning: it is v
|
|||
"The password must be at least %u characters."; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_The_X_password_has_been_changed_successfully = // Warning: it is very important to include %s in the following sentences
|
||||
const char *Txt_The_password_has_been_changed_successfully =
|
||||
#if L==1
|
||||
"La contraseña de %s se ha modificado con éxito."; // Necessita traduccio
|
||||
"La contraseña se ha modificado con éxito."; // Necessita traduccio
|
||||
#elif L==2
|
||||
"The %s password has been changed successfully."; // Need Übersetzung
|
||||
"The password has been changed successfully."; // Need Übersetzung
|
||||
#elif L==3
|
||||
"The %s password has been changed successfully.";
|
||||
"The password has been changed successfully.";
|
||||
#elif L==4
|
||||
"La contraseña de %s se ha modificado con éxito.";
|
||||
"La contraseña se ha modificado con éxito.";
|
||||
#elif L==5
|
||||
"The %s password has been changed successfully."; // Besoin de traduction
|
||||
"The %password has been changed successfully."; // Besoin de traduction
|
||||
#elif L==6
|
||||
"La contraseña de %s se ha modificado con éxito."; // Okoteve traducción
|
||||
"La contraseña se ha modificado con éxito."; // Okoteve traducción
|
||||
#elif L==7
|
||||
"La %s password è stata cambiata con successo.";
|
||||
"La password è stata cambiata con successo.";
|
||||
#elif L==8
|
||||
"The %s password has been changed successfully."; // Potrzebujesz tlumaczenie
|
||||
"The password has been changed successfully."; // Potrzebujesz tlumaczenie
|
||||
#elif L==9
|
||||
"The %s password has been changed successfully."; // Necessita de tradução
|
||||
"The password has been changed successfully."; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_The_place_X_already_exists = // Warning: it is very important to include %s in the following sentences
|
||||
|
@ -57405,36 +57456,6 @@ const char *Txt_Your_comment_has_been_updated =
|
|||
"O seu comentário foi atualizado.";
|
||||
#endif
|
||||
|
||||
const char *Txt_Your_nickname_X_has_been_registered_successfully = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==1
|
||||
"Su apodo <strong>@%s</strong>"
|
||||
" se ha registrado correctamente."; // Necessita traduccio
|
||||
#elif L==2
|
||||
"Your nickname <strong>@%s</strong>"
|
||||
" has been registered successfully."; // Need Übersetzung
|
||||
#elif L==3
|
||||
"Your nickname <strong>@%s</strong>"
|
||||
" has been registered successfully.";
|
||||
#elif L==4
|
||||
"Su apodo <strong>@%s</strong>"
|
||||
" se ha registrado correctamente.";
|
||||
#elif L==5
|
||||
"Your nickname <strong>@%s</strong>"
|
||||
" has been registered successfully."; // Besoin de traduction
|
||||
#elif L==6
|
||||
"Su apodo <strong>@%s</strong>"
|
||||
" se ha registrado correctamente."; // Okoteve traducción
|
||||
#elif L==7
|
||||
"Il tuo nome utente <strong>@%s</strong>"
|
||||
" è stato registrato con successo.";
|
||||
#elif L==8
|
||||
"Your nickname <strong>@%s</strong>"
|
||||
" has been registered successfully."; // Potrzebujesz tlumaczenie
|
||||
#elif L==9
|
||||
"Your nickname <strong>@%s</strong>"
|
||||
" has been registered successfully."; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_Your_password_has_been_changed_successfully =
|
||||
#if L==1
|
||||
"Su contraseña se ha modificado con éxito."; // Necessita traduccio
|
||||
|
|
|
@ -2877,6 +2877,7 @@ void Usr_ChkUsrAndGetUsrData (void)
|
|||
|
||||
/* Send message via email to confirm the new email address */
|
||||
Mai_SendMailMsgToConfirmEmail ();
|
||||
Ale_ShowPendingAlert (); // Show alert after sending email confirmation
|
||||
}
|
||||
}
|
||||
else // Gbl.Action.Act != ActCreUsrAcc
|
||||
|
|
|
@ -711,7 +711,7 @@ int swad__createAccount (struct soap *soap,
|
|||
true); // I am creating my own account
|
||||
|
||||
/***** Save nickname *****/
|
||||
Nck_UpdateMyNick (NewNicknameWithoutArroba);
|
||||
Nck_UpdateNickInDB (Gbl.Usrs.Me.UsrDat.UsrCod,NewNicknameWithoutArroba);
|
||||
Str_Copy (Gbl.Usrs.Me.UsrDat.Nickname,NewNicknameWithoutArroba,
|
||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
|
||||
|
|
Loading…
Reference in New Issue