Best practices: how to implement the invitation system in the Zend Framework?

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.

+4
source share
5 answers

I use paper and pen to visualize what I really want. If the flow is clear, I think you can do it;)

+3
source

I would definitely add validation to make sure that this address is already in the database before trying to insert. You can trap for an exception, but I would prefer to explicitly check for an email address.

The idea is for you ... When the email address already exists, you can force the system to resend the invitation. If you do this, you can reduce the repeated code without creating the additional function "re-send the invitation." Just call the same “send invitation” feature in the initial invitation request, or the “re-send invitation” link described by others.

I also like the idea that others have already mentioned the Resend invitation, especially in the implementation of philipnorton42.

+1
source

I would use a validator inside your form, so the emailaddress address is checked for your already saved emails. Therefore, there should be no duplicates. I would also perform an action that lists all of your entered accounts, as well as the creation and activation times in a good table. Of course, the action and presentation will support pagination, so you can easily navigate your data. If the record has not yet been activated, there should be a link, maybe an icon, to the action of resending by email for this special record. And another action that resends the email to all non-activated items would be convenient. And last but not least, I would run a report, so I can easily understand what is happening.

+1
source

I would say that Walter is right, you may need to extract what you want to accomplish.

However, you discover (I can say) that you have all the information for the “Repeat invitation” button that the administrator can click to send the invitation. I would create several reports in the backend that would allow me to view invitations that were sent, that were converted to users, and that have not yet received a response. Adding a button to the message has not yet answered that re-sending individual invitations should not be too complicated.

0
source

Hum, I would create a view where all the "Activations" are visible, with a button to just send an invitation? No change to the record inside the database.

0
source

All Articles