4

I've built out most of the functionality, now I'm getting stuck...

I am creating a private, web application that has an invite only registration system. An admin user sends an email invitation to a user, the user clicks the link, and takes them to a page where they can create an account that has been linked to their email address.

When the form is submitted and does not have any validation errors, the data is inserted into the database for the first time. The email column of the invitations table is unique, so this is the token that the user needs in order to verify that they have permission to create an account.

The situation that I am confused about is when the admin user tries sending an invitation to the same email address. The email address column is unique so there is an SQL error. I don't know if I should do a check for that email address before inserting that record in the database, or what I should do.

I want to create a re-send invitation feature for emails that get lost, or accidentally deleted. Which is why I didn't want the admin user to be able to send a duplicate email to the same person, rather, they should use the re-send feature.

I hope this is all making sense. Any insights would be appreciated.

4

5 回答 5

3

我用纸和笔来想象我真正想要的东西。如果流程很清楚,我认为您可以做到;)

于 2009-10-28T08:54:02.007 回答
1

我会在您的表单中使用验证器,因此会根据您已存储的电子邮件检查电子邮件地址。所以不应该有重复的条目。我还将实施一个操作,在一个漂亮的表格中列出您输入的所有帐户以及创建和激活时间。当然,动作和视图将支持分页,因此您可以轻松浏览数据。如果一个条目还没有被激活,那么应该有一个链接,也可能是一个图标,指向这个特殊条目的重新发送电子邮件操作。另一个将电子邮件重新发送到所有尚未激活的条目的操作会很方便。最后但并非最不重要的一点是,我将实施报告操作,以便我可以轻松弄清楚发生了什么。

于 2009-11-05T18:37:51.633 回答
1

在您尝试插入之前,我肯定会添加一个检查以查看该地址是否已经在数据库中。您可以捕获异常,但我更愿意明确测试电子邮件地址的存在。

给你一个想法...当电子邮件地址已经存在时,你可以让系统重新发送邀请。如果你这样做了,你也许可以通过不必编写额外的“重新发送邀请”函数来减少一些代码重复。只需在初始邀请请求上调用相同的“发送邀请”功能,或其他人描述的“重新发送邀请”链接。

我也喜欢其他人已经提到的“重新发送邀请”的想法,尤其是 philipnorton42 的实现。

于 2009-10-29T17:36:12.693 回答
0

我会说 Valter 是正确的,你可能需要画出你想要完成的事情。

但是,您似乎(据我所知)已准备好“重新发送邀请”按钮的所有信息,管理员可以单击该按钮重新发送邀请。我会在后端创建一些报告,让我可以查看已发送、已转换为用户以及尚未得到答复的邀请。在尚未回答的报告中添加一个重新发送个人邀请的按钮应该不会太难。

于 2009-10-28T09:18:39.620 回答
0

嗯,我会创建一个所有“激活”都可见的视图,并带有一个按钮来重新发送邀请?无需更改数据库内的记录。

于 2009-10-28T11:15:36.847 回答