Rails设计-确实确实确认动作的端点

问题描述 投票:0回答:1

我正在使用devise进行身份验证,现在我想为给定的电子邮件设置确认帐户(devise中的:confirmable模块)。我的应用程序是一个API应用程序,它使用REST端点与前端应用程序(实际上是移动应用程序)连接。我想知道标准设计流程中的哪个端点负责发送电子邮件,以及哪个实际确认帐户(钩住电子邮件中的confirm按钮)。

我的路线:

root@83afeb8ffb71:/usr/src/app# rails routes | grep account
  new_account_confirmation GET    /api/v1/account/confirmation/new(.:format)                                               api/v1/account/confirmations#new {:format=>:json}
      account_confirmation GET    /api/v1/account/confirmation(.:format)                                                   api/v1/account/confirmations#show {:format=>:json}
                           POST   /api/v1/account/confirmation(.:format)                                                   api/v1/account/confirmations#create {:format=>:json}

我在docs中看到电子邮件是由POST /api/v1/account/confirmation触发的,所以当用户从电子邮件中单击confirm按钮时,哪个端点正在进行某些更改?我在文档中看不到任何PUT端点。

ruby-on-rails devise
1个回答
0
投票
  1. 确认时发送的确认电子邮件(默认情况下),因此您不必需要致电POST /api/v1/account/confirmation
  2. 你不能将用户重定向到PUT POST DELETE PATCH仅重定向到GET,因此在您的应用程序发送此URL GET /api/v1/account/confirmation的电子邮件中,您可以在此端点上使用深度链接并将用户重定向到应用程序。
© www.soinside.com 2019 - 2024. All rights reserved.