[英]Routing error: No route matches [PATCH] “/users/sign_in” for devise update password
我正在嘗試驗證可更新當前用戶密碼的update_password api。 我正在使用devise,我的應用程序是SPA,前端側成角度。 當我嘗試用郵遞員客戶端驗證api時,當前出現此錯誤。
def update
@user = User.find(current_user.id)
if @user.update_with_password(user_params)
# Sign in the user by passing validation in case their password changed
sign_in @user, :bypass => true
redirect_to root_path , notice: "Password was successfully changed"
else
# render "edit"
respond_to do |format|
format.html { redirect_to edit_user_registration_path, alert: @user.errors.full_messages.first.to_s }
end
# render "edit"
end
end
在我看來,您需要在Postman標題中指定用戶。 您在Postman中列出的uri是要更新用戶,但是您的錯誤是沒有用戶登錄路徑,我認為這意味着它無權訪問用戶進行更新。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.