这些是我的应用程序中使用的版本规范,
导轨5.2.3 红宝石2.6.2 devise_token_auth 1.1.0
在此端点的用户注册期间, http://localhost:3000/api/v1/auth/ 我得到如下确认网址, http://localhost:3000/api/v1/auth/confirmation?config=default&confirmation_token=GHz9m52xVeQJJLFLJnWw&redirect_url=%2F
点击上面的确认URL时,我可以看到“ ConfirmationsController#show”方法可能被调用了两次。第一次调用时说确认成功,第二次调用时抛出错误“ [{:: error =>:already_confirmed}]}>”,这会导致路由错误,
Started GET "/api/v1/auth/confirmation?config=default&confirmation_token=GHz9m52xVeQJJLFLJnWw&redirect_url=%2F" for ::1 at 2019-05-04 14:45:46 +0530
Processing by DeviseTokenAuth::ConfirmationsController#show as HTML
Parameters: {"config"=>"default", "confirmation_token"=>"GHz9m52xVeQJJLFLJnWw", "redirect_url"=>"/"}
User Load (0.7ms) SELECT "users".* FROM "users" WHERE "users"."confirmation_token" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["confirmation_token", "GHz9m52xVeQJJLFLJnWw"], ["LIMIT", 1]]
↳ /home/user/.rvm/gems/ruby-2.6.2@church/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
(0.3ms) BEGIN
↳ /home/user/.rvm/gems/ruby-2.6.2@church/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
User Update (0.7ms) UPDATE "users" SET "confirmed_at" = $1, "updated_at" = $2 WHERE "users"."id" = $3 [["confirmed_at", "2019-05-04 09:15:46.325684"], ["updated_at", "2019-05-04 09:15:46.326717"], ["id", 26]]
↳ /home/user/.rvm/gems/ruby-2.6.2@church/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
(1.4ms) COMMIT
↳ /home/user/.rvm/gems/ruby-2.6.2@church/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
Redirected to http://localhost:3000:///?account_confirmation_success=true
Completed 302 Found in 21ms (ActiveRecord: 3.1ms)
Started GET "/api/v1/auth/confirmation?config=default&confirmation_token=GHz9m52xVeQJJLFLJnWw&redirect_url=%2F" for ::1 at 2019-05-04 14:45:46 +0530
Processing by DeviseTokenAuth::ConfirmationsController#show as HTML
Parameters: {"config"=>"default", "confirmation_token"=>"GHz9m52xVeQJJLFLJnWw", "redirect_url"=>"/"}
User Load (0.7ms) SELECT "users".* FROM "users" WHERE "users"."confirmation_token" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["confirmation_token", "GHz9m52xVeQJJLFLJnWw"], ["LIMIT", 1]]
↳ /home/user/.rvm/gems/ruby-2.6.2@church/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
Completed 404 Not Found in 6ms (ActiveRecord: 0.7ms)
ActionController::RoutingError (Not Found):
devise_token_auth (1.1.0) app/controllers/devise_token_auth/confirmations_controller.rb:30:in `show'
actionpack (5.2.3) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
使用此网址登录时, http://localhost:3000/api/v1/auth/sign_in 我得到了回复,
{ “成功”:错误, “错误”:[ “确认电子邮件已通过'123@gmail.com'发送到您的帐户。必须先按照电子邮件中的说明进行操作,然后才能激活帐户” ] }
问题, 1.为什么点击确认网址时两次调用“ ConfirmationsController#show”? 2.为什么即使确认成功用户也无法登录?
我在这里错过了什么?