使用电子邮件验证进行用户注册,并在 Ruby 中进行身份验证

发布于 2024-07-29 19:10:17 字数 1092 浏览 0 评论 0原文

我正在尝试在 Sinatra 中制作一个网络应用程序,我想知道是否有一个好的解决方案用于通过电子邮件验证以及身份验证进行用户注册 - 也许作为机架中间件? 如果有 OpenID 支持就好了。

我想我可以自己动手,但我不想重新发明轮子。 如果我必须这样做,任何人都可以向我指出我可能想要使用的库,甚至是示例代码吗? 我还担心我最终可能会忘记实施一些重要的注册/身份验证功能,因为我以前从未这样做过。

如果我需要自制解决方案,我找到了用于密码加密的 bcrypt-rubySinatra::MailerPony 发送电子邮件。 要使用 OpenID 支持进行登录,可以使用 hancockhancock-client,虽然我不太清楚用法,而且我实际上并不需要 单点登录支持。 也许我应该使用 ruby openid 库? 我还需要什么吗?

这是一个相当混乱的问题,但我希望更有经验的人可以指出我正确的方向。

I'm trying to make a web app in Sinatra, and I was wondering if there was a good solution for user sign-up with email verification, as well as authentication - perhaps as rack middleware? OpenID support would be nice to have too.

I suppose I can roll my own, but I didn't want to reinvent the wheel. If I have to do so, can anyone point me to the libraries I might want to use, maybe even example code? I'm also worried I might end up forgetting to implement something important with signup/authentication, since I've never done this before.

In case I need a homemade solution, I've found bcrypt-ruby for password encryption and Sinatra::Mailer or Pony for email. For signing on with OpenID support, there's hancock and hancock-client, though I'm not entirely clear on usage and I don't actually need single sign-on support. Maybe I should just use a ruby openid library? Do I need anything else?

This is a pretty muddled question, but I hope someone more experienced can point me in the right direction.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

┼── 2024-08-05 19:10:17

您可能对 Authlogic 感兴趣。 您需要自己实现电子邮件验证,但这将为您提供支持这一点的良好基础。

Authlogic 可以
在您想要的任何 ruby​​ 框架中使用:
Rails、Merb、Sinatra、Mack、您自己的
框架,无论如何。 它没有被束缚
到 Rails。 它通过以下方式做到这一点
从这些中抽象出来
框架的控制器通过使用
控制器适配器。 感谢机架,
有一个明确的标准
控制器结构,这就是
Authlogic 的抽象适配器如下。
因此,如果您的控制器跟随机架
标准,你不需要做
任何东西。

You might be interested in Authlogic. You'll need to implement the e-mail verification yourself, but it will provide you with a good foundation for supporting this.

Authlogic can be
used in any ruby framework you want:
Rails, Merb, Sinatra, Mack, your own
framework, whatever. It’s not tied
down to Rails. It does this by
abstracting itself from these
framework’s controllers by using a
controller adapter. Thanks to Rack,
there is a defined standard for
controller structure, and that’s what
Authlogic’s abstract adapter follows.
So if your controller follows the rack
standards, you don’t need to do
anything.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文