Skip to content

Conversation

@godefv
Copy link

@godefv godefv commented Jan 26, 2017

No description provided.

@godefv godefv requested review from eltrai and fishilico January 26, 2017 22:09
$full_name = build_full_name($firstname, $lastname);
$directory_name = build_directory_name($firstname, $lastname);
$sort_name = build_sort_name($firstname, $lastname);
XDB::execute('INSERT INTO accounts SET firstname={?}, lastname={?}, full_name={?}, directory_name={?}, sort_name={?}, hruid={?}, email={?}, type={?}, state={?}', $firstname, $lastname, $full_name, $directory_name, $sort_name, $hruid, Get::v('email'), "xnet", "active");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may break if an hruid already exists for the given email address? User::makeHrid (https://github.com/Polytechnique-org/platal/blob/core/1.1.16/maint/classes/pluser.php#L431) is not injective. For example:

makeHrid("[email protected]") == makeHrid("[email protected]")

A possible solution would be to add a counter when a collision happens

XDB::execute('INSERT INTO accounts SET firstname={?}, lastname={?}, hruid={?}, email={?}', Get::v('prenom'), Get::v('nom'), Get::v('prenom').".".Get::v('nom'), Get::v('email'));

//check if the email address is already registered
$res=XDB::query("SELECT hruid FROM accounts WHERE email={?}", Get::v('email'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to check the email redirections too

@godefv
Copy link
Author

godefv commented Jan 30, 2017

À voir :

  • forcer les gens à remplir nom prénom
  • mettre à jour le nom prénom au moins s'il est actuellement vide
  • gérer le cas des comptes extérieurs disabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants