2014-12-01 23:55:08 +01:00
|
|
|
|
// swad_ID.c: Users' IDs
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
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.
|
2024-02-07 00:40:28 +01:00
|
|
|
|
Copyright (C) 1999-2024 Antonio Ca<EFBFBD>as Vargas
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General Public 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 <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************************* Headers ***********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-12-29 23:41:26 +01:00
|
|
|
|
#define _GNU_SOURCE // For asprintf
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include <ctype.h> // For isalnum, isdigit, etc.
|
2015-10-16 02:24:29 +02:00
|
|
|
|
#include <stdbool.h> // For boolean type
|
2021-12-29 23:41:26 +01:00
|
|
|
|
#include <stdio.h> // For asprintf
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include <stdlib.h> // For exit, system, malloc, free, rand, etc.
|
|
|
|
|
#include <string.h> // For string functions
|
|
|
|
|
|
2014-12-12 22:39:55 +01:00
|
|
|
|
#include "swad_account.h"
|
2022-11-06 18:11:10 +01:00
|
|
|
|
#include "swad_action_list.h"
|
2022-10-19 18:07:49 +02:00
|
|
|
|
#include "swad_alert.h"
|
2017-06-10 21:38:10 +02:00
|
|
|
|
#include "swad_box.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_database.h"
|
2021-04-26 15:27:27 +02:00
|
|
|
|
#include "swad_error.h"
|
2018-11-09 20:47:39 +01:00
|
|
|
|
#include "swad_form.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_global.h"
|
2023-09-22 14:47:56 +02:00
|
|
|
|
#include "swad_hierarchy_type.h"
|
2019-10-23 19:05:05 +02:00
|
|
|
|
#include "swad_HTML.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_ID.h"
|
2021-09-20 22:01:59 +02:00
|
|
|
|
#include "swad_ID_database.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_parameter.h"
|
|
|
|
|
#include "swad_QR.h"
|
|
|
|
|
#include "swad_user.h"
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** External global variables from others modules ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern struct Globals Gbl;
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private constants *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#define ID_MAX_IDS_PER_USER 3 // Maximum number of IDs per user
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private variables *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2018-10-16 01:36:13 +02:00
|
|
|
|
const char *ID_ID_SECTION_ID = "id_section";
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private prototypes ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static bool ID_CheckIfUsrIDIsValidUsingMinDigits (const char *UsrID,unsigned MinDigits);
|
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
static void ID_PutLinkToConfirmID (struct Usr_Data *UsrDat,unsigned NumID,
|
2017-05-09 20:56:02 +02:00
|
|
|
|
const char *Anchor);
|
2016-04-23 19:59:45 +02:00
|
|
|
|
|
2023-04-04 13:46:51 +02:00
|
|
|
|
static void ID_ShowFormChangeUsrID (Usr_MeOrOther_t MeOrOther,bool IShouldFillInID);
|
2020-10-14 00:59:24 +02:00
|
|
|
|
|
2023-03-10 00:13:55 +01:00
|
|
|
|
static void ID_PutParsRemoveMyID (void *ID);
|
|
|
|
|
static void ID_PutParsRemoveOtherID (void *ID);
|
2018-10-15 14:07:12 +02:00
|
|
|
|
|
2023-04-04 13:46:51 +02:00
|
|
|
|
static void ID_RemoveUsrID (const struct Usr_Data *UsrDat,Usr_MeOrOther_t MeOrOther);
|
|
|
|
|
static void ID_ChangeUsrID (const struct Usr_Data *UsrDat,Usr_MeOrOther_t MeOrOther);
|
2021-06-10 13:50:23 +02:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************** Get list of IDs of a user ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
void ID_GetListIDsFromUsrCod (struct Usr_Data *UsrDat)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
MYSQL_ROW row;
|
|
|
|
|
unsigned NumIDs;
|
|
|
|
|
unsigned NumID;
|
|
|
|
|
|
|
|
|
|
/***** Initialize list of IDs to an empty list *****/
|
|
|
|
|
ID_FreeListIDs (UsrDat);
|
|
|
|
|
|
|
|
|
|
if (UsrDat->UsrCod > 0)
|
|
|
|
|
{
|
|
|
|
|
/***** Get user's IDs from database *****/
|
2018-10-31 13:00:40 +01:00
|
|
|
|
// First the confirmed (Confirmed == 'Y')
|
2014-12-01 23:55:08 +01:00
|
|
|
|
// Then the unconfirmed (Confirmed == 'N')
|
2021-09-20 22:01:59 +02:00
|
|
|
|
if ((NumIDs = ID_DB_GetIDsFromUsrCod (&mysql_res,UsrDat->UsrCod)))
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Allocate space for the list *****/
|
|
|
|
|
ID_ReallocateListIDs (UsrDat,NumIDs);
|
|
|
|
|
|
|
|
|
|
/***** Get list of IDs *****/
|
|
|
|
|
for (NumID = 0;
|
|
|
|
|
NumID < NumIDs;
|
|
|
|
|
NumID++)
|
|
|
|
|
{
|
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
|
|
|
|
|
|
|
|
|
/* Get ID from row[0] */
|
2017-01-17 03:10:43 +01:00
|
|
|
|
Str_Copy (UsrDat->IDs.List[NumID].ID,row[0],
|
2021-02-15 16:25:55 +01:00
|
|
|
|
sizeof (UsrDat->IDs.List[NumID].ID) - 1);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get if ID is confirmed from row[1] */
|
2016-09-07 18:48:10 +02:00
|
|
|
|
UsrDat->IDs.List[NumID].Confirmed = (row[1][0] == 'Y');
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************** Free memory allocated for list of IDs *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
void ID_ReallocateListIDs (struct Usr_Data *UsrDat,unsigned NumIDs)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Free list of IDs if used *****/
|
|
|
|
|
ID_FreeListIDs (UsrDat);
|
|
|
|
|
|
|
|
|
|
/***** Assign number of IDs in list *****/
|
|
|
|
|
UsrDat->IDs.Num = NumIDs;
|
|
|
|
|
|
|
|
|
|
/***** Allocate space for the list *****/
|
2021-02-15 16:25:55 +01:00
|
|
|
|
if ((UsrDat->IDs.List = malloc (NumIDs * sizeof (*UsrDat->IDs.List))) == NULL)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************** Free memory allocated for list of IDs *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
void ID_FreeListIDs (struct Usr_Data *UsrDat)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Free list *****/
|
|
|
|
|
if (UsrDat->IDs.Num && UsrDat->IDs.List)
|
2019-11-06 19:45:20 +01:00
|
|
|
|
free (UsrDat->IDs.List);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Reset list *****/
|
|
|
|
|
UsrDat->IDs.List = NULL;
|
|
|
|
|
UsrDat->IDs.Num = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************** Get list of user codes from user's IDs ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
// Returns the number of users with any of these IDs
|
|
|
|
|
// The list of users' codes is allocated inside this function and should be freed by caller
|
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
unsigned ID_GetListUsrCodsFromUsrID (struct Usr_Data *UsrDat,
|
2014-12-01 23:55:08 +01:00
|
|
|
|
const char *EncryptedPassword, // If NULL or empty ==> do not check password
|
2022-09-24 18:30:26 +02:00
|
|
|
|
struct Usr_ListUsrCods *ListUsrCods,
|
2014-12-01 23:55:08 +01:00
|
|
|
|
bool OnlyConfirmedIDs)
|
|
|
|
|
{
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
unsigned NumUsr;
|
|
|
|
|
|
|
|
|
|
if (UsrDat->IDs.Num)
|
|
|
|
|
{
|
2021-09-20 22:01:59 +02:00
|
|
|
|
if ((ListUsrCods->NumUsrs = ID_DB_GetUsrCodsFromUsrID (&mysql_res,
|
|
|
|
|
UsrDat,
|
|
|
|
|
EncryptedPassword,
|
|
|
|
|
OnlyConfirmedIDs)))
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Allocate space for the list of users' codes *****/
|
|
|
|
|
Usr_AllocateListUsrCods (ListUsrCods);
|
|
|
|
|
// The list should be freed by caller
|
|
|
|
|
|
|
|
|
|
/***** Fill the list *****/
|
|
|
|
|
for (NumUsr = 0;
|
|
|
|
|
NumUsr < ListUsrCods->NumUsrs;
|
|
|
|
|
NumUsr++)
|
2021-04-05 23:45:24 +02:00
|
|
|
|
/* Get user's code */
|
|
|
|
|
ListUsrCods->Lst[NumUsr] = DB_GetNextCode (mysql_res);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
UsrDat->UsrCod = ListUsrCods->Lst[0]; // The first user found
|
|
|
|
|
}
|
|
|
|
|
else // ListUsrCods->NumUsrs == 0
|
|
|
|
|
{
|
|
|
|
|
ListUsrCods->Lst = NULL;
|
|
|
|
|
UsrDat->UsrCod = -1L;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
}
|
|
|
|
|
else // List of user's IDs is empty
|
|
|
|
|
{
|
|
|
|
|
ListUsrCods->NumUsrs = 0;
|
|
|
|
|
ListUsrCods->Lst = NULL;
|
|
|
|
|
UsrDat->UsrCod = -1L;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ListUsrCods->NumUsrs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******* Put hidden parameter with the plain user's ID of other user *********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-03-10 00:13:55 +01:00
|
|
|
|
void ID_PutParOtherUsrIDPlain (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2023-03-07 09:55:39 +01:00
|
|
|
|
Par_PutParString (NULL,"OtherUsrID",
|
2023-03-10 00:13:55 +01:00
|
|
|
|
(Gbl.Usrs.Other.UsrDat.IDs.Num &&
|
|
|
|
|
Gbl.Usrs.Other.UsrDat.IDs.List) ? Gbl.Usrs.Other.UsrDat.IDs.List[0].ID :
|
|
|
|
|
"");
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********* Get parameter plain user's ID of other user from a form ***********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-03-10 00:13:55 +01:00
|
|
|
|
void ID_GetParOtherUsrIDPlain (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Allocate space for the list *****/
|
|
|
|
|
ID_ReallocateListIDs (&Gbl.Usrs.Other.UsrDat,1);
|
|
|
|
|
|
|
|
|
|
/***** Get parameter *****/
|
2023-03-07 09:55:39 +01:00
|
|
|
|
Par_GetParText ("OtherUsrID",Gbl.Usrs.Other.UsrDat.IDs.List[0].ID,
|
2017-03-07 01:56:41 +01:00
|
|
|
|
ID_MAX_BYTES_USR_ID);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
// Users' IDs are always stored internally in capitals and without leading zeros
|
|
|
|
|
Str_RemoveLeadingZeros (Gbl.Usrs.Other.UsrDat.IDs.List[0].ID);
|
|
|
|
|
Str_ConvertToUpperText (Gbl.Usrs.Other.UsrDat.IDs.List[0].ID);
|
|
|
|
|
|
|
|
|
|
Gbl.Usrs.Other.UsrDat.IDs.List[0].Confirmed = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****** Check whether a user's ID without the ending letter is valid *********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
// Returns true if the user's ID string is valid, or false if not
|
|
|
|
|
// A valid user's ID must...:
|
2017-03-07 01:56:41 +01:00
|
|
|
|
// 1. Must be ID_MIN_BYTES_USR_ID <= characters <= ID_MAX_BYTES_USR_ID.
|
2014-12-01 23:55:08 +01:00
|
|
|
|
// 2. All characters must be digits or letters
|
|
|
|
|
// 3. Must have a minimum number of digits
|
|
|
|
|
|
|
|
|
|
// Wrapper function to avoid passing extra parameters
|
|
|
|
|
bool ID_CheckIfUsrIDIsValid (const char *UsrID)
|
|
|
|
|
{
|
2015-10-07 19:55:13 +02:00
|
|
|
|
if (UsrID)
|
|
|
|
|
if (UsrID[0])
|
|
|
|
|
return ID_CheckIfUsrIDIsValidUsingMinDigits (UsrID,ID_MIN_DIGITS_USR_ID);
|
|
|
|
|
|
|
|
|
|
return false;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Wrapper function to avoid passing extra parameters
|
|
|
|
|
bool ID_CheckIfUsrIDSeemsAValidID (const char *UsrID)
|
|
|
|
|
{
|
2015-10-07 19:55:13 +02:00
|
|
|
|
if (UsrID)
|
|
|
|
|
if (UsrID[0])
|
|
|
|
|
return ID_CheckIfUsrIDIsValidUsingMinDigits (UsrID,ID_MIN_DIGITS_AUTOMATIC_DETECT_USR_ID);
|
|
|
|
|
|
|
|
|
|
return false;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool ID_CheckIfUsrIDIsValidUsingMinDigits (const char *UsrID,unsigned MinDigits)
|
|
|
|
|
{
|
|
|
|
|
const char *Ptr;
|
|
|
|
|
unsigned NumDigits = 0;
|
2015-10-07 19:55:13 +02:00
|
|
|
|
unsigned Length;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Check length *****/
|
2015-10-07 19:55:13 +02:00
|
|
|
|
if (!UsrID)
|
|
|
|
|
return false;
|
|
|
|
|
if (!UsrID[0])
|
|
|
|
|
return false;
|
|
|
|
|
Length = strlen (UsrID);
|
2017-03-07 01:56:41 +01:00
|
|
|
|
if (Length < ID_MIN_BYTES_USR_ID ||
|
|
|
|
|
Length > ID_MAX_BYTES_USR_ID)
|
|
|
|
|
return false; // 1. Must be ID_MIN_BYTES_USR_ID <= characters <= ID_MAX_BYTES_USR_ID
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/**** Loop through user's ID *****/
|
|
|
|
|
for (Ptr = UsrID;
|
|
|
|
|
*Ptr;
|
|
|
|
|
Ptr++)
|
|
|
|
|
if (isdigit ((int) *Ptr)) // If character is digit
|
|
|
|
|
NumDigits++;
|
|
|
|
|
else if (!((*Ptr >= 'A' && *Ptr <= 'Z') ||
|
|
|
|
|
(*Ptr >= 'a' && *Ptr <= 'z'))) // If character is not alpha
|
|
|
|
|
return false; // 2. All characters must be digits or letters
|
|
|
|
|
|
|
|
|
|
return (NumDigits >= MinDigits); // 3. Must have MinDigits digits at least
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************************** Write list of user's ID *************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
void ID_WriteUsrIDs (struct Usr_Data *UsrDat,const char *Anchor)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
unsigned NumID;
|
2024-04-19 12:00:30 +02:00
|
|
|
|
Usr_Can_t ICanSeeUsrID = ID_ICanSeeOtherUsrIDs (UsrDat);
|
|
|
|
|
Usr_Can_t ICanConfirmUsrID = (ICanSeeUsrID == Usr_CAN &&
|
2024-04-02 13:07:43 +02:00
|
|
|
|
Usr_ItsMe (UsrDat->UsrCod) == Usr_OTHER && // Not me
|
|
|
|
|
!Frm_CheckIfInside () && // Not inside another form
|
2024-04-23 23:54:23 +02:00
|
|
|
|
Act_GetBrowserTab (Gbl.Action.Act) == Act_1ST) ? Usr_CAN : // Only in main browser tab
|
2024-04-19 12:00:30 +02:00
|
|
|
|
Usr_CAN_NOT;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2016-04-23 13:23:09 +02:00
|
|
|
|
for (NumID = 0;
|
|
|
|
|
NumID < UsrDat->IDs.Num;
|
|
|
|
|
NumID++)
|
|
|
|
|
{
|
2023-09-14 12:53:33 +02:00
|
|
|
|
/* If not the first ID ==> new line */
|
2016-04-23 13:23:09 +02:00
|
|
|
|
if (NumID)
|
2019-11-09 21:08:20 +01:00
|
|
|
|
HTM_BR ();
|
2015-03-05 21:42:02 +01:00
|
|
|
|
|
2023-09-14 12:53:33 +02:00
|
|
|
|
/* Write this ID */
|
2022-04-25 11:03:02 +02:00
|
|
|
|
HTM_SPAN_Begin ("class=\"%s_%s\"",
|
2019-11-07 10:24:00 +01:00
|
|
|
|
UsrDat->IDs.List[NumID].Confirmed ? "USR_ID_C" :
|
2022-04-25 11:03:02 +02:00
|
|
|
|
"USR_ID_NC",
|
|
|
|
|
The_GetSuffix ());
|
2024-04-06 21:23:53 +02:00
|
|
|
|
switch (ICanSeeUsrID)
|
|
|
|
|
{
|
2024-04-19 12:00:30 +02:00
|
|
|
|
case Usr_CAN:
|
2024-04-06 21:23:53 +02:00
|
|
|
|
HTM_Txt (UsrDat->IDs.List[NumID].ID);
|
|
|
|
|
break;
|
2024-04-19 12:00:30 +02:00
|
|
|
|
case Usr_CAN_NOT:
|
2024-04-06 21:23:53 +02:00
|
|
|
|
default:
|
|
|
|
|
HTM_Txt ("********");
|
|
|
|
|
break;
|
|
|
|
|
}
|
2019-11-07 10:24:00 +01:00
|
|
|
|
HTM_SPAN_End ();
|
2016-04-23 19:59:45 +02:00
|
|
|
|
|
2023-09-14 12:53:33 +02:00
|
|
|
|
/* Put link to confirm ID? */
|
2024-04-19 12:00:30 +02:00
|
|
|
|
if (ICanConfirmUsrID == Usr_CAN &&
|
2024-04-06 21:23:53 +02:00
|
|
|
|
!UsrDat->IDs.List[NumID].Confirmed)
|
2017-05-09 20:56:02 +02:00
|
|
|
|
ID_PutLinkToConfirmID (UsrDat,NumID,Anchor);
|
2016-04-23 19:59:45 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************** Check if I can see another user's IDs *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2024-04-19 12:00:30 +02:00
|
|
|
|
Usr_Can_t ID_ICanSeeOtherUsrIDs (const struct Usr_Data *UsrDat)
|
2016-04-23 19:59:45 +02:00
|
|
|
|
{
|
2023-04-04 13:46:51 +02:00
|
|
|
|
/***** Fast check: It's me? *****/
|
|
|
|
|
if (Usr_ItsMe (UsrDat->UsrCod) == Usr_ME)
|
2024-04-19 12:00:30 +02:00
|
|
|
|
return Usr_CAN;
|
2017-01-27 01:02:52 +01:00
|
|
|
|
|
2016-04-23 19:59:45 +02:00
|
|
|
|
/***** Check if I have permission to see another user's IDs *****/
|
2017-06-04 18:18:54 +02:00
|
|
|
|
switch (Gbl.Usrs.Me.Role.Logged)
|
2016-04-23 19:59:45 +02:00
|
|
|
|
{
|
2017-05-22 12:23:08 +02:00
|
|
|
|
case Rol_NET:
|
2017-05-18 19:13:41 +02:00
|
|
|
|
case Rol_TCH:
|
2017-01-27 15:21:01 +01:00
|
|
|
|
/* Check 1: I can see the IDs of users who do not exist in database */
|
|
|
|
|
if (UsrDat->UsrCod <= 0) // User does not exist (when creating a new user)
|
2024-04-19 12:00:30 +02:00
|
|
|
|
return Usr_CAN;
|
2017-01-27 15:21:01 +01:00
|
|
|
|
|
|
|
|
|
/* Check 2: I can see the IDs of confirmed students */
|
2021-04-24 15:10:07 +02:00
|
|
|
|
if (UsrDat->Roles.InCurrentCrs == Rol_STD && // A student
|
|
|
|
|
UsrDat->Accepted) // who accepted registration
|
2024-04-19 12:00:30 +02:00
|
|
|
|
return Usr_CAN;
|
2017-01-27 15:21:01 +01:00
|
|
|
|
|
|
|
|
|
/* Check 3: I can see the IDs of users with user's data empty */
|
2017-01-27 18:45:38 +01:00
|
|
|
|
// This check is made to not view simultaneously:
|
|
|
|
|
// - an ID
|
|
|
|
|
// - a name or an email
|
2017-01-27 15:21:01 +01:00
|
|
|
|
if (!UsrDat->Password[0] && // User has no password (never logged)
|
|
|
|
|
!UsrDat->Surname1[0] && // and who has no surname 1 (nobody filled user's surname 1)
|
|
|
|
|
!UsrDat->Surname2[0] && // and who has no surname 2 (nobody filled user's surname 2)
|
2021-02-15 16:25:55 +01:00
|
|
|
|
!UsrDat->FrstName[0] && // and who has no first name (nobody filled user's first name)
|
2017-01-27 18:45:38 +01:00
|
|
|
|
!UsrDat->Email[0]) // and who has no email (nobody filled user's email)
|
2024-04-19 12:00:30 +02:00
|
|
|
|
return Usr_CAN;
|
2017-01-27 15:21:01 +01:00
|
|
|
|
|
2024-04-19 12:00:30 +02:00
|
|
|
|
return Usr_CAN_NOT;
|
2016-04-23 19:59:45 +02:00
|
|
|
|
case Rol_DEG_ADM:
|
|
|
|
|
case Rol_CTR_ADM:
|
|
|
|
|
case Rol_INS_ADM:
|
|
|
|
|
case Rol_SYS_ADM:
|
2024-04-01 17:59:51 +02:00
|
|
|
|
return Usr_CheckIfICanEditOtherUsr (UsrDat);
|
2016-04-23 19:59:45 +02:00
|
|
|
|
default:
|
2024-04-19 12:00:30 +02:00
|
|
|
|
return Usr_CAN_NOT;
|
2016-04-23 13:23:09 +02:00
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-23 23:47:22 +02:00
|
|
|
|
/*****************************************************************************/
|
2017-06-11 20:09:59 +02:00
|
|
|
|
/****************** Put a link to confirm another user's ID ******************/
|
2016-04-23 23:47:22 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
static void ID_PutLinkToConfirmID (struct Usr_Data *UsrDat,unsigned NumID,
|
2017-05-09 20:56:02 +02:00
|
|
|
|
const char *Anchor)
|
2016-04-23 23:47:22 +02:00
|
|
|
|
{
|
2016-04-24 22:01:22 +02:00
|
|
|
|
extern const char *Txt_Confirm_ID;
|
2024-03-20 09:39:04 +01:00
|
|
|
|
static Act_Action_t NextAction[Rol_NUM_ROLES] =
|
2021-11-10 21:04:34 +01:00
|
|
|
|
{
|
|
|
|
|
[Rol_UNK ] = ActCnfID_Oth,
|
|
|
|
|
[Rol_GST ] = ActCnfID_Oth,
|
|
|
|
|
[Rol_USR ] = ActCnfID_Oth,
|
|
|
|
|
[Rol_STD ] = ActCnfID_Std,
|
|
|
|
|
[Rol_NET ] = ActCnfID_Tch,
|
|
|
|
|
[Rol_TCH ] = ActCnfID_Tch,
|
|
|
|
|
[Rol_DEG_ADM] = ActCnfID_Oth,
|
|
|
|
|
[Rol_CTR_ADM] = ActCnfID_Oth,
|
|
|
|
|
[Rol_INS_ADM] = ActCnfID_Oth,
|
|
|
|
|
[Rol_SYS_ADM] = ActCnfID_Oth,
|
|
|
|
|
};
|
2016-04-24 02:42:23 +02:00
|
|
|
|
|
2019-10-20 22:00:28 +02:00
|
|
|
|
/***** Begin form *****/
|
2021-11-10 21:04:34 +01:00
|
|
|
|
Frm_BeginFormAnchor (NextAction[UsrDat->Roles.InCurrentCrs],Anchor);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
if (Gbl.Action.Original != ActUnk)
|
2017-05-09 20:56:02 +02:00
|
|
|
|
{
|
2023-03-10 17:21:04 +01:00
|
|
|
|
ParCod_PutPar (ParCod_OrgAct,Act_GetActCod (Gbl.Action.Original)); // Original action, used to know where we came from
|
2021-12-01 01:43:13 +01:00
|
|
|
|
switch (Gbl.Action.Original)
|
|
|
|
|
{
|
|
|
|
|
case ActSeeRecSevGst:
|
|
|
|
|
case ActSeeRecSevStd:
|
|
|
|
|
case ActSeeRecSevTch:
|
2023-03-10 00:13:55 +01:00
|
|
|
|
Usr_PutParSelectedUsrsCods (&Gbl.Usrs.Selected);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2017-05-09 20:56:02 +02:00
|
|
|
|
}
|
2023-03-10 00:13:55 +01:00
|
|
|
|
Usr_PutParUsrCodEncrypted (UsrDat->EnUsrCod);
|
2023-03-07 09:55:39 +01:00
|
|
|
|
Par_PutParString (NULL,"UsrID",UsrDat->IDs.List[NumID].ID);
|
2017-05-09 20:56:02 +02:00
|
|
|
|
|
2021-09-20 22:01:59 +02:00
|
|
|
|
/***** Put link *****/
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Txt_Confirm_ID,
|
|
|
|
|
"class=\"BT_LINK FORM_OUT_%s BOLD\"",
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2021-12-22 00:20:06 +01:00
|
|
|
|
Ico_PutIconTextLink ("check.svg",Ico_BLACK,Txt_Confirm_ID);
|
2021-09-20 22:01:59 +02:00
|
|
|
|
HTM_BUTTON_End ();
|
2016-04-24 02:42:23 +02:00
|
|
|
|
|
2017-05-09 20:56:02 +02:00
|
|
|
|
/***** End form *****/
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2016-04-23 23:47:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********************** Show form to change my user's ID ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-02-15 21:09:18 +01:00
|
|
|
|
void ID_ShowFormChangeMyID (bool IShouldFillInID)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2018-10-15 14:07:12 +02:00
|
|
|
|
extern const char *Hlp_PROFILE_Account;
|
2023-12-07 17:19:11 +01:00
|
|
|
|
extern const char *Txt_ID_identity_number;
|
2018-10-15 14:07:12 +02:00
|
|
|
|
|
2021-03-02 00:54:26 +01:00
|
|
|
|
/***** Begin section *****/
|
2019-10-26 01:56:36 +02:00
|
|
|
|
HTM_SECTION_Begin (ID_ID_SECTION_ID);
|
2018-10-15 14:07:12 +02:00
|
|
|
|
|
2021-09-20 22:01:59 +02:00
|
|
|
|
/***** Begin box *****/
|
2024-01-29 09:45:28 +01:00
|
|
|
|
Box_BoxBegin (Txt_ID_identity_number,Acc_PutLinkToRemoveMyAccount,NULL,
|
2023-11-27 08:56:16 +01:00
|
|
|
|
Hlp_PROFILE_Account,Box_NOT_CLOSABLE);
|
2018-10-15 14:07:12 +02:00
|
|
|
|
|
2023-11-27 08:56:16 +01:00
|
|
|
|
/***** Show form to change ID *****/
|
|
|
|
|
ID_ShowFormChangeUsrID (Usr_ME,IShouldFillInID);
|
2018-10-15 14:07:12 +02:00
|
|
|
|
|
2023-11-27 08:56:16 +01:00
|
|
|
|
/***** End box *****/
|
|
|
|
|
Box_BoxEnd ();
|
2018-10-15 14:07:12 +02:00
|
|
|
|
|
|
|
|
|
/***** End section *****/
|
2019-10-26 01:56:36 +02:00
|
|
|
|
HTM_SECTION_End ();
|
2018-10-15 14:07:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********************** Show form to change my user's ID ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void ID_ShowFormChangeOtherUsrID (void)
|
|
|
|
|
{
|
2018-10-16 01:36:13 +02:00
|
|
|
|
extern const char *Hlp_PROFILE_Account;
|
2023-12-07 17:19:11 +01:00
|
|
|
|
extern const char *Txt_ID_identity_number;
|
2018-10-16 01:36:13 +02:00
|
|
|
|
|
2021-03-02 00:54:26 +01:00
|
|
|
|
/***** Begin section *****/
|
2019-10-26 01:56:36 +02:00
|
|
|
|
HTM_SECTION_Begin (ID_ID_SECTION_ID);
|
2018-10-15 14:07:12 +02:00
|
|
|
|
|
2021-09-20 22:01:59 +02:00
|
|
|
|
/***** Begin box *****/
|
2024-01-29 09:45:28 +01:00
|
|
|
|
Box_BoxBegin (Txt_ID_identity_number,NULL,NULL,
|
2023-11-27 08:56:16 +01:00
|
|
|
|
Hlp_PROFILE_Account,Box_NOT_CLOSABLE);
|
|
|
|
|
|
|
|
|
|
/***** Show form to change ID *****/
|
|
|
|
|
ID_ShowFormChangeUsrID (Usr_OTHER,
|
|
|
|
|
false); // IShouldFillInID
|
|
|
|
|
|
|
|
|
|
/***** End box *****/
|
|
|
|
|
Box_BoxEnd ();
|
2018-10-16 01:36:13 +02:00
|
|
|
|
|
2018-10-15 14:07:12 +02:00
|
|
|
|
/***** End section *****/
|
2019-10-26 01:56:36 +02:00
|
|
|
|
HTM_SECTION_End ();
|
2018-10-15 14:07:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********************** Show form to change my user's ID ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-04-04 13:46:51 +02:00
|
|
|
|
static void ID_ShowFormChangeUsrID (Usr_MeOrOther_t MeOrOther,bool IShouldFillInID)
|
2018-10-15 14:07:12 +02:00
|
|
|
|
{
|
|
|
|
|
extern const char *Hlp_PROFILE_Account;
|
|
|
|
|
extern const char *Txt_Please_fill_in_your_ID;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_ID_X_confirmed;
|
2016-04-23 17:12:01 +02:00
|
|
|
|
extern const char *Txt_ID_X_not_confirmed;
|
2023-12-07 17:19:11 +01:00
|
|
|
|
extern const char *Txt_ID_identity_number;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_Another_ID;
|
|
|
|
|
extern const char *Txt_Add_this_ID;
|
2014-12-13 21:38:31 +01:00
|
|
|
|
extern const char *Txt_The_ID_is_used_in_order_to_facilitate_;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
unsigned NumID;
|
2021-12-29 23:41:26 +01:00
|
|
|
|
char *Title;
|
2021-11-10 21:04:34 +01:00
|
|
|
|
static const struct
|
|
|
|
|
{
|
|
|
|
|
Act_Action_t Remove;
|
2023-04-04 13:46:51 +02:00
|
|
|
|
Act_Action_t Change;
|
2021-11-10 21:04:34 +01:00
|
|
|
|
} NextAction[Rol_NUM_ROLES] =
|
|
|
|
|
{
|
2023-04-04 13:46:51 +02:00
|
|
|
|
[Rol_UNK ] = {ActRemID_Oth,ActChgID_Oth},
|
|
|
|
|
[Rol_GST ] = {ActRemID_Oth,ActChgID_Oth},
|
|
|
|
|
[Rol_USR ] = {ActRemID_Oth,ActChgID_Oth},
|
|
|
|
|
[Rol_STD ] = {ActRemID_Std,ActChgID_Std},
|
|
|
|
|
[Rol_NET ] = {ActRemID_Tch,ActChgID_Tch},
|
|
|
|
|
[Rol_TCH ] = {ActRemID_Tch,ActChgID_Tch},
|
|
|
|
|
[Rol_DEG_ADM] = {ActRemID_Oth,ActChgID_Oth},
|
|
|
|
|
[Rol_CTR_ADM] = {ActRemID_Oth,ActChgID_Oth},
|
|
|
|
|
[Rol_INS_ADM] = {ActRemID_Oth,ActChgID_Oth},
|
|
|
|
|
[Rol_SYS_ADM] = {ActRemID_Oth,ActChgID_Oth},
|
|
|
|
|
};
|
|
|
|
|
static const struct Usr_Data *UsrDat[Usr_NUM_ME_OR_OTHER] =
|
|
|
|
|
{
|
|
|
|
|
[Usr_ME ] = &Gbl.Usrs.Me.UsrDat,
|
|
|
|
|
[Usr_OTHER] = &Gbl.Usrs.Other.UsrDat
|
|
|
|
|
};
|
|
|
|
|
static void (*FuncParsRemove[Usr_NUM_ME_OR_OTHER]) (void *ID) =
|
|
|
|
|
{
|
|
|
|
|
[Usr_ME ] = ID_PutParsRemoveMyID,
|
|
|
|
|
[Usr_OTHER] = ID_PutParsRemoveOtherID
|
|
|
|
|
};
|
|
|
|
|
struct
|
|
|
|
|
{
|
|
|
|
|
Act_Action_t Remove;
|
|
|
|
|
Act_Action_t Change;
|
|
|
|
|
} ActID[Rol_NUM_ROLES] =
|
|
|
|
|
{
|
|
|
|
|
[Usr_ME ] = {.Remove = ActRemMyID,
|
|
|
|
|
.Change = ActChgMyID},
|
|
|
|
|
[Usr_OTHER] = {.Remove = NextAction[Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs].Remove,
|
|
|
|
|
.Change = NextAction[Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs].Change}
|
2021-11-10 21:04:34 +01:00
|
|
|
|
};
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-03-09 20:12:44 +01:00
|
|
|
|
/***** Show possible alerts *****/
|
|
|
|
|
Ale_ShowAlerts (ID_ID_SECTION_ID);
|
2018-10-15 14:07:12 +02:00
|
|
|
|
|
|
|
|
|
/***** Help message *****/
|
2019-02-15 21:09:18 +01:00
|
|
|
|
if (IShouldFillInID)
|
2019-02-16 16:18:54 +01:00
|
|
|
|
Ale_ShowAlert (Ale_WARNING,Txt_Please_fill_in_your_ID);
|
2018-10-15 14:07:12 +02:00
|
|
|
|
|
2019-10-20 22:00:28 +02:00
|
|
|
|
/***** Begin table *****/
|
2024-01-29 00:11:10 +01:00
|
|
|
|
HTM_TABLE_BeginPadding (2);
|
2018-10-15 14:07:12 +02:00
|
|
|
|
|
2021-09-20 22:01:59 +02:00
|
|
|
|
/***** List existing user's IDs *****/
|
|
|
|
|
for (NumID = 0;
|
2023-04-04 13:46:51 +02:00
|
|
|
|
NumID < UsrDat[MeOrOther]->IDs.Num;
|
2021-09-20 22:01:59 +02:00
|
|
|
|
NumID++)
|
2019-10-04 14:42:59 +02:00
|
|
|
|
{
|
2021-09-20 22:01:59 +02:00
|
|
|
|
if (NumID == 0)
|
|
|
|
|
{
|
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-08 23:28:51 +02:00
|
|
|
|
|
2021-09-20 22:01:59 +02:00
|
|
|
|
/* Label */
|
2024-01-30 15:08:53 +01:00
|
|
|
|
Frm_LabelColumn ("Frm_C1 RT",NULL,Txt_ID_identity_number);
|
2019-10-07 15:15:55 +02:00
|
|
|
|
|
2021-09-20 22:01:59 +02:00
|
|
|
|
/* Data */
|
2024-01-30 15:08:53 +01:00
|
|
|
|
HTM_TD_Begin ("class=\"Frm_C2 LT DAT_STRONG_%s\"",The_GetSuffix ());
|
2021-09-20 22:01:59 +02:00
|
|
|
|
}
|
|
|
|
|
else // NumID >= 1
|
|
|
|
|
HTM_BR ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2023-04-04 13:46:51 +02:00
|
|
|
|
if (UsrDat[MeOrOther]->IDs.Num > 1) // I have two or more IDs
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2023-04-04 13:46:51 +02:00
|
|
|
|
if (MeOrOther == Usr_ME &&
|
|
|
|
|
UsrDat[MeOrOther]->IDs.List[NumID].Confirmed) // I can not remove my confirmed IDs
|
2021-09-20 22:01:59 +02:00
|
|
|
|
/* Put disabled icon to remove user's ID */
|
|
|
|
|
Ico_PutIconRemovalNotAllowed ();
|
2023-04-04 13:46:51 +02:00
|
|
|
|
else // I can remove
|
2021-09-20 22:01:59 +02:00
|
|
|
|
/* Form to remove user's ID */
|
2023-04-04 13:46:51 +02:00
|
|
|
|
Ico_PutContextualIconToRemove (ActID[MeOrOther].Remove,ID_ID_SECTION_ID,
|
|
|
|
|
FuncParsRemove[MeOrOther],UsrDat[MeOrOther]->IDs.List[NumID].ID);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-20 22:01:59 +02:00
|
|
|
|
/* User's ID */
|
2023-04-04 13:46:51 +02:00
|
|
|
|
if (asprintf (&Title,UsrDat[MeOrOther]->IDs.List[NumID].Confirmed ? Txt_ID_X_confirmed :
|
|
|
|
|
Txt_ID_X_not_confirmed,
|
|
|
|
|
UsrDat[MeOrOther]->IDs.List[NumID].ID) < 0)
|
2021-12-29 23:41:26 +01:00
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2021-09-20 22:01:59 +02:00
|
|
|
|
HTM_SPAN_Begin ("class=\"%s\" title=\"%s\"",
|
2023-04-04 13:46:51 +02:00
|
|
|
|
UsrDat[MeOrOther]->IDs.List[NumID].Confirmed ? "USR_ID_C" :
|
|
|
|
|
"USR_ID_NC",
|
2021-12-29 23:41:26 +01:00
|
|
|
|
Title);
|
|
|
|
|
free (Title);
|
2023-04-04 13:46:51 +02:00
|
|
|
|
HTM_Txt (UsrDat[MeOrOther]->IDs.List[NumID].ID);
|
|
|
|
|
HTM_Txt (UsrDat[MeOrOther]->IDs.List[NumID].Confirmed ? "✓" :
|
2021-09-20 22:01:59 +02:00
|
|
|
|
"");
|
|
|
|
|
HTM_SPAN_End ();
|
|
|
|
|
|
2023-04-04 13:46:51 +02:00
|
|
|
|
if (NumID == UsrDat[MeOrOther]->IDs.Num - 1)
|
2021-09-20 22:01:59 +02:00
|
|
|
|
{
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
2019-10-04 20:43:43 +02:00
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2023-04-04 13:46:51 +02:00
|
|
|
|
if (UsrDat[MeOrOther]->IDs.Num < ID_MAX_IDS_PER_USER)
|
2021-09-20 22:01:59 +02:00
|
|
|
|
{
|
|
|
|
|
/***** Write help text *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 15:15:55 +02:00
|
|
|
|
|
2024-06-20 10:51:17 +02:00
|
|
|
|
HTM_TD_Begin ("colspan=\"2\" class=\"CM DAT_%s\"",The_GetSuffix ());
|
2021-09-20 22:01:59 +02:00
|
|
|
|
Ale_ShowAlert (Ale_INFO,Txt_The_ID_is_used_in_order_to_facilitate_);
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 15:15:55 +02:00
|
|
|
|
|
2021-09-20 22:01:59 +02:00
|
|
|
|
HTM_TR_End ();
|
2018-10-10 14:03:06 +02:00
|
|
|
|
|
2021-09-20 22:01:59 +02:00
|
|
|
|
/***** Form to enter new user's ID *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 15:15:55 +02:00
|
|
|
|
|
2021-09-20 22:01:59 +02:00
|
|
|
|
/* Label */
|
2024-01-30 15:08:53 +01:00
|
|
|
|
Frm_LabelColumn ("Frm_C1 RT","NewID",
|
2023-12-07 17:19:11 +01:00
|
|
|
|
UsrDat[MeOrOther]->IDs.Num ? Txt_Another_ID : // A new user's ID
|
|
|
|
|
Txt_ID_identity_number); // The first user's ID
|
2019-10-07 15:15:55 +02:00
|
|
|
|
|
2021-09-20 22:01:59 +02:00
|
|
|
|
/* Data */
|
2024-01-30 15:08:53 +01:00
|
|
|
|
HTM_TD_Begin ("class=\"Frm_C2 LT DAT_%s\"",The_GetSuffix ());
|
2023-04-04 13:46:51 +02:00
|
|
|
|
Frm_BeginFormAnchor (ActID[MeOrOther].Change,ID_ID_SECTION_ID);
|
|
|
|
|
if (MeOrOther == Usr_OTHER)
|
|
|
|
|
Usr_PutParUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EnUsrCod);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
HTM_INPUT_TEXT ("NewID",ID_MAX_BYTES_USR_ID,
|
2023-04-04 13:46:51 +02:00
|
|
|
|
UsrDat[MeOrOther]->IDs.Num ? UsrDat[MeOrOther]->IDs.List[UsrDat[MeOrOther]->IDs.Num - 1].ID :
|
|
|
|
|
"", // Show the most recent ID
|
2024-06-07 10:44:31 +02:00
|
|
|
|
HTM_NO_ATTR,
|
2024-01-30 15:08:53 +01:00
|
|
|
|
"id=\"NewID\" class=\"Frm_C2_INPUT INPUT_%s\""
|
2024-06-20 10:51:17 +02:00
|
|
|
|
" size=\"16\"",The_GetSuffix ());
|
2021-12-01 01:43:13 +01:00
|
|
|
|
HTM_BR ();
|
|
|
|
|
Btn_PutCreateButtonInline (Txt_Add_this_ID);
|
2021-09-20 22:01:59 +02:00
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2018-10-15 14:07:12 +02:00
|
|
|
|
|
|
|
|
|
/***** End table *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TABLE_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-10 00:13:55 +01:00
|
|
|
|
static void ID_PutParsRemoveMyID (void *ID)
|
2020-10-14 00:59:24 +02:00
|
|
|
|
{
|
|
|
|
|
if (ID)
|
2023-03-07 09:55:39 +01:00
|
|
|
|
Par_PutParString (NULL,"UsrID",(char *) ID);
|
2020-10-14 00:59:24 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-10 00:13:55 +01:00
|
|
|
|
static void ID_PutParsRemoveOtherID (void *ID)
|
2020-10-14 00:59:24 +02:00
|
|
|
|
{
|
|
|
|
|
if (ID)
|
|
|
|
|
{
|
2023-03-10 00:13:55 +01:00
|
|
|
|
Usr_PutParUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EnUsrCod);
|
2023-03-07 09:55:39 +01:00
|
|
|
|
Par_PutParString (NULL,"UsrID",(char *) ID);
|
2020-10-14 00:59:24 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************** Remove one of my user's IDs **************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void ID_RemoveMyUsrID (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Remove user's ID *****/
|
2023-05-30 13:17:16 +02:00
|
|
|
|
ID_RemoveUsrID (&Gbl.Usrs.Me.UsrDat,Usr_ME);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Update list of IDs *****/
|
|