-
Notifications
You must be signed in to change notification settings - Fork 3
【wip】パスワードリセット部分の作成 #1981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gm3/develop
Are you sure you want to change the base?
【wip】パスワードリセット部分の作成 #1981
Changes from all commits
acfa6bb
9f6045d
488d3fc
ecc8674
fb99ecd
b3255d1
e3936f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,6 +50,8 @@ end | |
| group :development do | ||
| gem 'listen', '~> 3.2' | ||
| # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring | ||
| gem 'letter_opener' | ||
| gem 'letter_opener_web' | ||
| gem 'r2-oas' | ||
| gem 'spring' | ||
| gem 'spring-watcher-listen', '~> 2.0.0' | ||
|
Comment on lines
56
to
57
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Api | ||
| module Auth | ||
| class PasswordsController < DeviseTokenAuth::PasswordsController | ||
| # Devise Token Auth 標準のパスワードリセットフローを利用します。 | ||
| # 基本的な挙動は親クラスに委譲し、必要があればここでカスタマイズします。 | ||
| end | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| class ApplicationMailer < ActionMailer::Base | ||
| default from: 'from@example.com' | ||
| default from: ENV.fetch('MAILER_SENDER', 'no-reply@group-manager.nutfes.net') | ||
| layout 'mailer' | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| <% email_label = | ||
| if @resource.respond_to?(:name) && @resource.name.present? | ||
| "#{@resource.name} 様" | ||
| elsif @resource.respond_to?(:email) && @resource.email.present? | ||
| "#{@resource.email} 様" | ||
| else | ||
| "ご利用者様" | ||
| end %> | ||
| <% uid = | ||
| if @resource.respond_to?(:uid) && @resource.uid.present? | ||
| @resource.uid | ||
| elsif @resource.respond_to?(:email) && @resource.email.present? | ||
| @resource.email | ||
| end %> | ||
| <% client_id = | ||
| if defined?(@client_id) && @client_id.present? | ||
| @client_id | ||
| elsif defined?(@client_config) && @client_config.present? | ||
| @client_config | ||
| end %> | ||
| <% redirect_base = defined?(@redirect_url) ? @redirect_url : nil %> | ||
| <% tokenised_link = | ||
| if redirect_base.present? && client_id.present? && uid.present? | ||
| query = { client_id: client_id, token: @token, uid: uid }.to_query | ||
| separator = redirect_base.include?('?') ? '&' : '?' | ||
| "#{redirect_base}#{separator}#{query}" | ||
| end %> | ||
| <% reset_link = | ||
| if tokenised_link.present? | ||
| tokenised_link | ||
| elsif respond_to?(:edit_password_url) | ||
| edit_password_url(@resource, reset_password_token: @token) | ||
| end %> | ||
| <% reset_link ||= '#' %> | ||
|
|
||
| <!DOCTYPE html> | ||
| <html lang="ja"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <title>パスワード再設定のご案内</title> | ||
| </head> | ||
| <body style="margin:0;padding:0;background-color:#f5f7fb;font-family:'Hiragino Kaku Gothic ProN',YuGothic,'メイリオ',sans-serif;color:#1f2933;"> | ||
| <div style="max-width:620px;margin:0 auto;padding:32px 24px;"> | ||
| <div style="background:#ffffff;border-radius:16px;padding:32px 28px;box-shadow:0 6px 18px rgba(15,23,42,0.08);"> | ||
| <h1 style="margin:0 0 16px;font-size:22px;font-weight:700;color:#111827;">パスワード再設定のご案内</h1> | ||
| <p style="margin:0 0 16px;line-height:1.7;"> | ||
| <%= email_label %>、こんにちは。<br /> | ||
| パスワード再設定のお申し込みを受け付けました。以下のボタンをクリックし、パスワード再設定ページへ進んでください。 | ||
| </p> | ||
|
|
||
| <div style="text-align:center;margin:28px 0;"> | ||
| <a | ||
| href="<%= reset_link %>" | ||
| style="display:inline-block;padding:14px 28px;background:#2563eb;color:#ffffff;font-weight:700;border-radius:999px;text-decoration:none;" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| > | ||
| パスワードを再設定する | ||
| </a> | ||
| </div> | ||
|
|
||
| <p style="margin:0 0 20px;line-height:1.7;"> | ||
| ボタンが正しく動作しない場合は、以下のURLをコピーしてブラウザに貼り付けてください。 | ||
| </p> | ||
| <p style="word-break:break-all;background:#f8fafc;padding:16px;border-radius:12px;border:1px solid #e2e8f0;margin:0 0 24px;"> | ||
| <a href="<%= reset_link %>" style="color:#1d4ed8;text-decoration:none;" target="_blank" rel="noopener noreferrer"><%= reset_link %></a> | ||
| </p> | ||
|
|
||
| <p style="margin:0 0 8px;line-height:1.7;"> | ||
| このリンクの有効期限は一度のみです。お心当たりのない操作の場合は、このメールを破棄してください。 | ||
| </p> | ||
| <p style="margin:0;line-height:1.7;color:#6b7280;font-size:13px;"> | ||
| 本メールは送信専用です。ご返信いただいても対応いたしかねますのでご了承ください。 | ||
| </p> | ||
| </div> | ||
| </div> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| <% email_label = | ||
| if @resource.respond_to?(:name) && @resource.name.present? | ||
| "#{@resource.name} 様" | ||
| elsif @resource.respond_to?(:email) && @resource.email.present? | ||
| "#{@resource.email} 様" | ||
| else | ||
| "ご利用者様" | ||
| end %> | ||
| <% uid = | ||
| if @resource.respond_to?(:uid) && @resource.uid.present? | ||
| @resource.uid | ||
| elsif @resource.respond_to?(:email) && @resource.email.present? | ||
| @resource.email | ||
| end %> | ||
| <% client_id = | ||
| if defined?(@client_id) && @client_id.present? | ||
| @client_id | ||
| elsif defined?(@client_config) && @client_config.present? | ||
| @client_config | ||
| end %> | ||
| <% redirect_base = defined?(@redirect_url) ? @redirect_url : nil %> | ||
| <% tokenised_link = | ||
| if redirect_base.present? && client_id.present? && uid.present? | ||
| query = { client_id: client_id, token: @token, uid: uid }.to_query | ||
| separator = redirect_base.include?('?') ? '&' : '?' | ||
| "#{redirect_base}#{separator}#{query}" | ||
| end %> | ||
| <% reset_link = | ||
| if tokenised_link.present? | ||
| tokenised_link | ||
| elsif respond_to?(:edit_password_url) | ||
| edit_password_url(@resource, reset_password_token: @token) | ||
| end %> | ||
| <% reset_link ||= '#' %> | ||
|
|
||
| パスワード再設定のご案内 | ||
|
|
||
| <%= email_label %>、こんにちは。 | ||
|
|
||
| パスワード再設定のお申し込みを受け付けました。以下のURLからパスワード再設定ページへ進んでください。 | ||
|
|
||
| <%= reset_link %> | ||
|
|
||
| このリンクの有効期限は一度のみです。お心当たりのない操作の場合は、このメールを破棄してください。 | ||
|
|
||
| 本メールは送信専用です。ご返信いただいても対応いたしかねますのでご了承ください。 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| Rails.application.routes.draw do | ||
| mount LetterOpenerWeb::Engine, at: '/letter_opener' if Rails.env.development? | ||
|
|
||
| # 識別番号割り当て | ||
|
Comment on lines
+4
to
6
|
||
| get 'group_identification' => 'group_identification#index' | ||
| post 'group_identification' => 'group_identification#create' | ||
|
|
@@ -336,7 +338,8 @@ | |
|
|
||
| namespace :api do | ||
| mount_devise_token_auth_for 'User', at: 'auth', controllers: { | ||
| registrations: 'api/auth/registrations' | ||
| registrations: 'api/auth/registrations', | ||
| passwords: 'api/auth/passwords' | ||
| } | ||
| namespace :auth do | ||
| resources :sessions | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] READMEに末尾のスペース取っちゃった変更が入ってるね😅 これは多分意図してないやつだと思うから、元に戻した方がいいかも💦
ruby 2.7.1 <br>こんな感じで末尾にスペース入れといた方が、マークダウンのフォーマットとして正しいよ~📝✨