2017-06-14 14 views
0

私たちはDeviseを使って認証します。しかし、私たちはより単純なパスワード回復プロセスを使用します。私は問題が異なる他の多くの同様の投稿を行ってきました。ここで完了401パスワード要求フォームで無許可

は私たちのフォームです:あなたの助けのための

Started POST "https://stackoverflow.com/users/send_new_password" for ::1 at 
    2017-06-14 10:40:09 -0400 
Processing by UsersController#send_new_password as HTML 
    Parameters: {"utf8"=>"✓", "authenticity_token"=>"qqV6bE4vY...", 
    "username"=>"Doe, John", "button"=>""} 
Completed 401 Unauthorized in 2ms (ActiveRecord: 0.4ms) 

ありがとう:

<%= form_tag send_new_password_users_path do %> 
    <%= text_field_tag 'username', nil %> 
    <%= button_tag "Request New Password" %> 
<% end %> 

私たちは、次のエラーメッセージが表示されます。

答えて

1

send_new_password(もちろん)自己倒産する前に、ユーザーがサインインすることを期待しています。

したがって、その操作のユーザー認証をバイパスする必要があります。

class UserController < ApplicationController 
    before_action :authenticate_user!, except[:send_new_password] 
+0

時々...私はばかです。 – Jay

+0

我々はすべてそこにいた。 :) – SteveTurczyn

関連する問題