Skip to content

Conversation

max-wittig
Copy link
Contributor

this change requires email adresses, like usernames to be unique

Fixes #664


/* Make sure email is unique */
$email_count = $this->dbManager->getSingleRow("SELECT * FROM users WHERE user_email = '".$Email."';");
if ($email_count > 1) {
Copy link
Member

Choose a reason for hiding this comment

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

The return value of getSingleRow is an array. I think there is a missing sizeof

Copy link
Member

Choose a reason for hiding this comment

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

please use select count(*) ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what I wanted to use in the first place, but it didn't work somehow. Gonna try that again.

Copy link
Member

Choose a reason for hiding this comment

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

You might have to unpack the singleton array containing the resulting integer.

this change requires email adresses, like usernames to be unique

Fixes fossology#664
@shaheemazmalmmd
Copy link
Member

i saw that in most of the cases people use email as "username".

consider the following case:

if the username of one user is "[email protected]" and email is "[email protected]"

and the same user adds another user with credentials vice versa like

username : "[email protected]" and email : "[email protected]"

i think both username and email should be checked for unique.

@max-wittig
Copy link
Contributor Author

username is already validated and required to be unique

@bufferoverflow bufferoverflow merged commit ea23995 into fossology:master Mar 13, 2017
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.

4 participants