电子邮件 Rails 中的加密查询字符串
我的应用程序发送一封包含 URL 的电子邮件。该 url 包含已加密的查询字符串属性。我 CGI 转义了加密值,以便使用像 + * 这样的符号。等都逃脱了。转义的 URL 按预期出现在电子邮件中,但当我们单击链接时,加密的值将被解密。
email=5M%2BjE1G6UB26tw/Ah%2Bzr1%2BJSSxeAoP6j
当我们单击此链接时,浏览器中的 url 显示为 http://development.com/activate/snJAmJxkMo3WZ1sG27Aq?album_id=2&email=5M+jE1G6UB26tw/Ah+zr1+JSSxeAoP6j&owner_id=4
email=5M+jE1G6UB26tw/Ah+zr1+JSSxeAoP6j
+ 替换为空格。因此 params[:email] = 5M jE1G6UB26tw/Ah zr1 JSSxeAoP6j
这给了我一个 404。
有什么办法可以避免这种情况。如何使浏览器中的网址也显示为
在浏览器中?
My app sends out an email with a URL in it. The url contains a query string attribute that is encrypted. I CGI escaped the encrypted value so that symbols like + * . etc are escaped. The escaped URL appears in the email as expected, but when we click on the link, the encrypted values are decrypted.
For Example, the url in the email is as follows
http://development.com/activate/snJAmJxkMo3WZ1sG27Aq?album_id=2&email=5M%2BjE1G6UB26tw/Ah%2Bzr1%2BJSSxeAoP6j&owner_id=4
email=5M%2BjE1G6UB26tw/Ah%2Bzr1%2BJSSxeAoP6j
when we click on this link the url in the browser appears as
http://development.com/activate/snJAmJxkMo3WZ1sG27Aq?album_id=2&email=5M+jE1G6UB26tw/Ah+zr1+JSSxeAoP6j&owner_id=4
email=5M+jE1G6UB26tw/Ah+zr1+JSSxeAoP6j
The + is substituted with space. As a result
params[:email] = 5M jE1G6UB26tw/Ah zr1 JSSxeAoP6j
which gives me a 404.
Is there any way I can avoid this situation. How can I make the url in the browser also appear as
in the browser?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了避免这种情况,我对电子邮件属性进行了十六进制编码,使其仅包含字母和数字。使用这些是十六进制编码和解码的方法。
In order to avoid this situation I Hex encoded the email attribute so that the it contains only alphabets and numbers. Used these are the methods to Hex encode and decode.