I created most of the functionality, now I'm stuck ...
I am creating a private web application that has an invitation-only registration system. The administrator user sends the user an invitation by e-mail, the user clicks the link and transfers them to a page where they can create an account associated with their email address.
When the form is submitted and has no validation errors, the data is inserted into the database for the first time. The email column of the invitation table is unique, so this is the token that the user needs to verify that they have permission to create an account.
The situation that I'm embarrassed about is when the admin user tries to send an invitation to the same email address. The email address column is unique, so there is an SQL error. I do not know if I should check this email address before inserting this entry into the database or what I should do.
I want to create a function to re-send invitations for emails that will be lost or accidentally deleted. That's why I didn’t want the administrator to be able to send a duplicate letter to the same person, instead they should use the re-send feature.
Hope this all makes sense. Any ideas would be appreciated.
source share