質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

315閲覧

ERR_CONNECTION_REFUSEDのエラー

higmonta

総合スコア29

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2022/06/11 17:06

sorcery gemのパスワードリセット機能を実装中に下記エラーになってしまいました。

letter_opener_web gemでメールの内容を確認しています。
コードは、以下のようになります。

class PasswordResetsController < ApplicationController # In Rails 5 and above, this will raise an error if # before_action :require_login # is not declared in your ApplicationController. # request password reset. # you get here when the user entered their email in the reset password form and submitted it. def new; end def create @user = User.find_by(email: params[:email]) # This line sends an email to the user with instructions on how to reset their password (a url with a random token) @user.deliver_reset_password_instructions! if @user # Tell the user instructions have been sent whether or not email was found. # This is to not leak information to attackers about which emails exist in the system. redirect_to login_path end # This is the reset password form. def edit @token = params[:id] @user = User.load_from_reset_password_token(@token) if @user.blank? not_authenticated return end end # This action fires when the user has sent the reset password form. def update @token = params[:id] @user = User.load_from_reset_password_token(params[:id]) if @user.blank? not_authenticated return end # the next line makes the password confirmation validation work @user.password_confirmation = params[:user][:password_confirmation] # the next line clears the temporary token and updates the password if @user.change_password(params[:user][:password]) redirect_to(root_path, :notice => 'Password was successfully updated.') else render :action => "edit" end end end

PasswordResetsControllerのcreateアクションは実行され、以下のようにメールが確認できます。

Image from Gyazo

メール本文をコピーしてリロードすると以下のようになります。

Image from Gyazo

ルーティング設定は、以下のようになっているので、ルーティングの問題では無いと考えています。

edit_password_reset GET /password_resets/:id/edit(.:format) password_resets#edit

参考記事を参照に試したことは、以下の項目になります。
・ルーターを違うものに変えた
・違うサイトを検索すると他のサイトは、普通に表示されます。
・ブラウザの種類を変えましたが、同じように表示されます。
・DNSキャッシュを削除する
・ブラウザのキャッシュを削除する

解消方法や原因が分からず詰まってしまいました。
ご教示お願いできればと思います。

参考記事

https://aprico-media.com/posts/3780

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

サーバーは develop@met 環境で立ち上げてるのだとおもいます。
すると port 80 ではなく 3000 では?
http:localhost/ ではなく http://localhost:3000/ で試してください

投稿2022/06/12 04:45

winterboum

総合スコア23340

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

higmonta

2022/06/16 15:58

ありがとうございました!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問