我想通过发送电子邮件让用户能够重置密码,但我不知道如何触发该电子邮件。这只是移动应用程序,因此前端应用程序使用端点与后端应用程序通信。我正在使用 devise 来验证用户身份,使用 swagger 测试端点和 Fast JSON API 进行序列化。
我的模式:
class Account < ApplicationRecord
devise :database_authenticatable, :registerable, :recoverable, :validatable,
:jwt_authenticatable, jwt_revocation_strategy: JwtBlacklist
belongs_to :profile, polymorphic: true
end
路线:
root@5539feaef343:/usr/src/app# rake routes | grep account
new_account_session GET /api/v1/account/sign_in(.:format) api/v1/account/sessions#new {:format=>:json}
account_session POST /api/v1/account/sign_in(.:format) api/v1/account/sessions#create {:format=>:json}
destroy_account_session DELETE /api/v1/account/sign_out(.:format) api/v1/account/sessions#destroy {:format=>:json}
new_account_password GET /api/v1/account/password/new(.:format) api/v1/account/passwords#new {:format=>:json}
edit_account_password GET /api/v1/account/password/edit(.:format) api/v1/account/passwords#edit {:format=>:json}
account_password PATCH /api/v1/account/password(.:format) api/v1/account/passwords#update {:format=>:json}
PUT /api/v1/account/password(.:format) api/v1/account/passwords#update {:format=>:json}
POST /api/v1/account/password(.:format) api/v1/account/passwords#create {:format=>:json}
cancel_account_registration GET /api/v1/account/cancel(.:format) api/v1/account/registrations#cancel {:format=>:json}
new_account_registration GET /api/v1/account/sign_up(.:format) api/v1/account/registrations#new {:format=>:json}
edit_account_registration GET /api/v1/account/edit(.:format) api/v1/account/registrations#edit {:format=>:json}
account_registration PATCH /api/v1/account(.:format) api/v1/account/registrations#update {:format=>:json}
PUT /api/v1/account(.:format) api/v1/account/registrations#update {:format=>:json}
DELETE /api/v1/account(.:format) api/v1/account/registrations#destroy {:format=>:json}
POST /api/v1/account(.:format) api/v1/account/registrations#create {:format=>:json}
api_v1_account GET /api/v1/account(.:format) api/v1/accounts#show {:format=>:json}
招摇端点:
GET/api/v1/account
Retrieves an account details
POST /api/v1/account
Creates new account
PUT /api/v1/account
Updates the account
DELETE /api/v1/account
Removes the account
POST /api/v1/account/sign_in
Log in with account
DELETE /api/v1/account/sign_out
问题是我不知道如何触发那封电子邮件,我已经recoverable
添加了模块,但是如何创建那个端点来测试它呢?