How does the Security Module enforce uniqueness of NAME and EMAIL fields?

Have am using the security module code generated by SC8 in my project and I’m using the standard table created by that module. My DB is Firebird 2.5. The PRIMARY KEY is LOGIN ID so duplicate additions to that field are prevented by the DB. However, when adding a new user, the app_form_add_users also, on it’s own, prevents addition of duplicates to the EMAIL field. There is no UNIQUE on this field, so the “duplicate prevention” functionality must be performed by the app_form_add_users some how. I cannot find anything in the Events nor PHP Methods that performs this function.

Can some one enlighten me as to how this is being done? I prefer to have complete control if possible and not rely on this being “built in” in the background. Also, in the future, I may want some other fields I’d like to add to the “unique enforcement” list.

Thanks in advance. (TIA)

Hi,

It is possible to you modify the database? you could use a KEY like UNIQUE, in that way, when you try to insert a record, will be appear like duplicate.

I hope this help to you.

Regards,

Hi Aymg, Yes, I can add a UNIQUE to the DB. My question is, SC8 already treats the field as a UNIQUE even when it is not marked as a UNIQUE in the DB. Some how, SC8 “knows” that the EMAIL field should be treated as a UNIQUE, even though it doesn’t have a UNIQUE index on it in the DB. There is some “magic” going on in the background. I’d like to know what that magic is. (Note that the tables and fields were all created by SC8’s Security Module, and in that module it creates the EMAIL field like an ordinary non-UNIQUE field)