// swad_account.c: user's account /* SWAD (Shared Workspace At a Distance), is a web platform developed at the University of Granada (Spain), and used to support university teaching. This file is part of SWAD core. Copyright (C) 1999-2019 Antonio Caņas Vargas This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General 3 License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ /*****************************************************************************/ /*********************************** Headers *********************************/ /*****************************************************************************/ #include // For string functions #include "swad_account.h" #include "swad_announcement.h" #include "swad_box.h" #include "swad_calendar.h" #include "swad_database.h" #include "swad_duplicate.h" #include "swad_enrolment.h" #include "swad_follow.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.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" #include "swad_report.h" #include "swad_timeline.h" /*****************************************************************************/ /****************************** Public constants *****************************/ /*****************************************************************************/ /*****************************************************************************/ /***************************** Private constants *****************************/ /*****************************************************************************/ /*****************************************************************************/ /****************************** Internal types *******************************/ /*****************************************************************************/ /*****************************************************************************/ /************** External global variables from others modules ****************/ /*****************************************************************************/ extern struct Globals Gbl; /*****************************************************************************/ /************************* Internal global variables *************************/ /*****************************************************************************/ /*****************************************************************************/ /***************************** Private prototypes ****************************/ /*****************************************************************************/ static void Acc_ShowFormCheckIfIHaveAccount (const char *Title); static void Acc_WriteRowEmptyAccount (unsigned NumUsr,const char *ID,struct UsrData *UsrDat); static void Acc_ShowFormRequestNewAccountWithParams (const char *NewNicknameWithoutArroba, const char *NewEmail); static bool Acc_GetParamsNewAccount (char NewNicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1], char *NewEmail, char *NewEncryptedPassword); static void Acc_CreateNewEncryptedUsrCod (struct UsrData *UsrDat); static void Acc_PutParamsToRemoveMyAccount (void); static void Acc_AskIfRemoveUsrAccount (bool ItsMe); static void Acc_AskIfRemoveOtherUsrAccount (void); static void Acc_RemoveUsrBriefcase (struct UsrData *UsrDat); static void Acc_RemoveUsr (struct UsrData *UsrDat); /*****************************************************************************/ /******************** Put link to create a new account ***********************/ /*****************************************************************************/ void Acc_PutLinkToCreateAccount (void) { extern const char *Txt_Create_account; Lay_PutContextualLinkIconText (ActFrmMyAcc,NULL,NULL, "at.svg", Txt_Create_account); } /*****************************************************************************/ /******** Show form to change my account or to create a new account **********/ /*****************************************************************************/ void Acc_ShowFormMyAccount (void) { extern const char *Txt_Before_creating_a_new_account_check_if_you_have_been_already_registered; if (Gbl.Usrs.Me.Logged) Acc_ShowFormChgMyAccount (); else // Not logged { /***** Contextual menu *****/ Mnu_ContextMenuBegin (); Usr_PutLinkToLogin (); Pwd_PutLinkToSendNewPasswd (); Lan_PutLinkToChangeLanguage (); Mnu_ContextMenuEnd (); /**** Show form to check if I have an account *****/ Acc_ShowFormCheckIfIHaveAccount (Txt_Before_creating_a_new_account_check_if_you_have_been_already_registered); } } /*****************************************************************************/ /***************** Show form to check if I have an account *******************/ /*****************************************************************************/ static void Acc_ShowFormCheckIfIHaveAccount (const char *Title) { extern const char *Hlp_PROFILE_SignUp; extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_If_you_think_you_may_have_been_registered_; extern const char *Txt_ID; extern const char *Txt_Check; extern const char *Txt_Skip_this_step; /***** Begin box *****/ Box_BoxBegin (NULL,Title,NULL, Hlp_PROFILE_SignUp,Box_NOT_CLOSABLE); /***** Help alert *****/ Ale_ShowAlert (Ale_INFO,Txt_If_you_think_you_may_have_been_registered_); /***** Form to request user's ID for possible account already created *****/ Frm_StartForm (ActChkUsrAcc); fprintf (Gbl.F.Out,"