简体   繁体   English

有没有一种方法可以只与特定的邮件收件人共享链接?

[英]Is there a way to share a link with only a spefic mail recipient?

Not sure if this question should come to SO, but here it goes. 不知道这个问题是否应该解决,但是可以解决。

I have the following scenario: 我有以下情况:

A Flask app with typical users that can login using username / password. 具有典型用户的Flask应用,可以使用用户名/密码登录。 Users can share some resources among them, but now we want to let them share those with anyone, not users of the app basically. 用户可以在其中共享一些资源,但是现在我们希望允许他们与任何人(基本上不是应用程序的用户)共享这些资源。

Because the resources content is important, only the person that received the email should be able to access the resource. 因为资源的内容很重要,所以只有接收电子邮件的人才能访问该资源。 Not everyone with the link, in other words. 换句话说,不是每个人都知道链接。

What I've thought so far: 到目前为止,我一直在想:

  • Create a one-time link -> This could work, but I'd prefer if the link is permanent 创建一个一次性链接->这可能有效,但是我希望链接是永久的

  • Add some Javascript in the HTML email message sent and add a parameter to the request sent so I can make sure the email address that opened the link was the correct one. 在发送的HTML电子邮件中添加一些Javascript,并在发送的请求中添加一个参数,这样我就可以确保打开链接的电子邮件地址正确。 This assuming that I can do that with Javascript...which is not clear to me. 假设我可以使用Javascript来做...对我来说还不清楚。 This will make the link permanent though. 但是,这将使链接永久。

Any toughts? 有困难吗? Thanks 谢谢

The first time someone accesses the URL, you could send them a random cookie, and save that cookie with the document. 首次有人访问该URL时,您可以向他们发送一个随机cookie,并将该cookie与文档一起保存。 On future accesses, check if the cookie matches the saved cookie. 在以后的访问中,检查cookie是否与保存的cookie匹配。 If they share the URL with someone, that person won't have the cookie. 如果他们与某人共享URL,则该人将没有该cookie。

Caveats: 注意事项:

  1. If they share the URL with someone else, and the other person goes to the URL first, they will be the one who can access it, not the original recipient. 如果他们与其他人共享该URL,而另一个人首先访问该URL,则他们将是可以访问该URL的人,而不是原始收件人。

  2. If the recipient clears cookies, they'll lose access to the document. 如果收件人清除了cookie,他们将失去对文档的访问权限。 You'll need a recovery procedure. 您将需要一个恢复过程。 This could send a new URL to the original email address. 这样可以将新的URL发送到原始电子邮件地址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM