From e544faab91c0883c829170892cab31968761c5a4 Mon Sep 17 00:00:00 2001 From: kato11433 Date: Mon, 10 Dec 2018 02:12:07 +0000 Subject: [PATCH] add password_reference --- app/assets/log_file.txt | 11 ++++ app/controllers/items_controller.rb | 2 +- .../password_reference_controller.rb | 48 ++++++++++++++++++ app/views/layouts/application.html.erb | 1 + app/views/mail_page/done.html.erb | 2 +- .../password_reference/do_ref_mail.html.erb | 1 + .../password_reference/ref_home.html.erb | 10 ++++ config/application.rb | 2 +- config/routes.rb | 10 ++++ ...MHZjSmmPj4R3UdV9M0_Rrl6QOWR8yxVQQlrU.cache | Bin 317 -> 621 bytes ...-S45aJ_PjVAC_Vmjyud3i1aQv4cE3t9_Z3Dw.cache | Bin 416 -> 508 bytes ...DFRvYhwwVJYKQKtCyVDpRXlmZqdMgJh-LVoc.cache | Bin 225 -> 437 bytes ...2STbcRAs7r9zuzaFu2FiuxFjYpR5VNKDVLSw.cache | Bin 257 -> 501 bytes ...BzEvvbtoPuwvQ0U2GWos07uF61KBhrc84AYE.cache | Bin 321 -> 629 bytes ...fz78SdVFWZ7FVU21qOXOZgQ_Z8K4QKkC7qRA.cache | Bin 1105 -> 1105 bytes 15 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 app/controllers/password_reference_controller.rb create mode 100644 app/views/password_reference/do_ref_mail.html.erb create mode 100644 app/views/password_reference/ref_home.html.erb diff --git a/app/assets/log_file.txt b/app/assets/log_file.txt index e69de29..58fbca7 100644 --- a/app/assets/log_file.txt +++ b/app/assets/log_file.txt @@ -0,0 +1,11 @@ +************************ +2018-12-03 09:57:33 +0900 +<仮出品完了> +商品ID: +商品名: a +場所ID: +商品画像: +商品価格: +商品詳細: +ジャンルID: +出品者学籍番号: diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb index f83fbb3..da34658 100644 --- a/app/controllers/items_controller.rb +++ b/app/controllers/items_controller.rb @@ -293,7 +293,7 @@ def token format.json { render :show, status: :created, location: @item } ActionMailer::Base.mail(from: "sg5td9uo@idcf.kke.com", to: "tsuku.byebuy@gmail.com", subject: "出品完了アラート", body:body).deliver - + end else # トークンがない、もしくは2回目のアクセス -> 失敗を通知、ユーザ登録ページのリンクを貼る diff --git a/app/controllers/password_reference_controller.rb b/app/controllers/password_reference_controller.rb new file mode 100644 index 0000000..1769e49 --- /dev/null +++ b/app/controllers/password_reference_controller.rb @@ -0,0 +1,48 @@ +class PasswordReferenceController < ApplicationController + def ref_home + + + end + + def do_ref_mail + + password = "error" + student_id = params[:student_id] + @item = Item.where(student_id: student_id) + @item.each do |item| + password = item.pass + end + # メール通知 + if student_id.to_s == "818129298" + email = "tsuku.byebuy@gmail.com" + else + email = student_id.to_s.gsub(/^20/, "s") + "@u.tsukuba.ac.jp" + end + + + + body = student_id.to_s + "様 + +これはパスワード照会用のメールです。 + +学籍番号:" + student_id.to_s + " + +パスワード:" + password.to_s + " + +※パスワードが Error と表示される場合はお手数ですがつくByeBuy運営まで連絡をお願いします。 + +このメールは筑波大学の講義「情報メディア実験B」での実習で作成されたものです。 +心当たりが無い場合、他の人が誤って貴方の学籍番号を登録した可能性があります。 +今後一切メールを受け取らないようにするには、大変お手数ですが下記のメールアドレスまでその旨の連絡をお願いいたします。 + +========================== + つくByeBuy運営 +tsuku.byebuy@gmail.com +========================== +" + ActionMailer::Base.mail(from: "sg5td9uo@idcf.kke.com", to: email, subject: "[つくByeBuy]パスワード照会", body:body).deliver + + end + + +end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index e70e6a5..85eba59 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -16,6 +16,7 @@ diff --git a/app/views/mail_page/done.html.erb b/app/views/mail_page/done.html.erb index e96b8d3..b2f2857 100644 --- a/app/views/mail_page/done.html.erb +++ b/app/views/mail_page/done.html.erb @@ -54,7 +54,7 @@ https://a2-autumn.herokuapp.com/items/" + @item.id.to_s + " ========================== enPiT2017 チームA1 tsuku.byebuy@gmail.com -========================== +========================== " %> <% end %> diff --git a/app/views/password_reference/do_ref_mail.html.erb b/app/views/password_reference/do_ref_mail.html.erb new file mode 100644 index 0000000..6b5ed80 --- /dev/null +++ b/app/views/password_reference/do_ref_mail.html.erb @@ -0,0 +1 @@ +メールを発送しました。
diff --git a/app/views/password_reference/ref_home.html.erb b/app/views/password_reference/ref_home.html.erb new file mode 100644 index 0000000..74e50cf --- /dev/null +++ b/app/views/password_reference/ref_home.html.erb @@ -0,0 +1,10 @@ +

パスワード照会

+あなたの学籍番号を入力して送信ボタンを押してください。
+メールにてパスワードが送信されます。
+※このパスワード照会によってパスワードが変更されることはありません。
+※パスワードは学籍番号ごとに設定されており、同じ学籍番号であれば全ての出品に対して同じパスワードが利用できます。
+ +<%= form_tag('do_ref_mail', method: :post) do %> +
<%= text_field_tag :student_id %>
+ <%= submit_tag "送信" %> +<% end %> diff --git a/config/application.rb b/config/application.rb index 07ae832..20faace 100644 --- a/config/application.rb +++ b/config/application.rb @@ -10,7 +10,7 @@ module A2 class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 5.1 - +#config.web_console.whitelisted_ips = '10.0.2.2' config.time_zone = 'Tokyo' config.active_record.default_timezone = :local # Settings in config/environments/* take precedence over those specified here. diff --git a/config/routes.rb b/config/routes.rb index df3add0..c34c467 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -43,6 +43,16 @@ get 'wants/home' post 'wants/home' => 'wants#new' post 'wants/new' => 'wants#home' + + get 'password_reference/ref_home' + get 'password_reference/do_ref_mail' + post 'password_reference/ref_home' => 'password_reference#do_ref_mail' + post 'password_reference/ref_home' => 'password_reference#ref_home' + post 'password_reference/do_ref_mail' => 'password_reference#do_ref_mail' + post 'password_reference/do_ref_mail' => 'password_reference#ref_home' + + + root 'items#index' # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end diff --git a/tmp/cache/assets/sprockets/v3.0/1T/1Tw4pIkMHZjSmmPj4R3UdV9M0_Rrl6QOWR8yxVQQlrU.cache b/tmp/cache/assets/sprockets/v3.0/1T/1Tw4pIkMHZjSmmPj4R3UdV9M0_Rrl6QOWR8yxVQQlrU.cache index 5c350e61c105d56df08c1649e71aad75c3a754a3..274a679cff7e52548dba7e5a400d4e56513dbe91 100644 GIT binary patch delta 51 zcmdnX^p=H%g(I4MBa0=YV!ky4n>AZ4m#30MYF=4pQGQ--YF>$MS!z*nW_})g``frp7@3x?8KMmmzE$@7-h2My`h5@kANwlopMmkh$8Qsc$?Ev@=o!eIYb8^V z#?L_`SJDf;cjxD)M^Ec}88Zob<45a_Cz^4AzTK`CK4e-&fT%QvrpVxgWtrd+GnS1m zSk5rgJTot1E?{yOAmbSbF5v`0#1(n4uJUJm4roG3Z6#%hV6aw*G-6W$Wbw=5@z$b9 z$(YY8*l-7ovS@8_vSHsz%~NIgv}((}M9>rhFac;GQo}ZhEN>Rl zM5RD;HrGrVO7zs;9a>#CqyZU`Ar*W|^>SL!Ii%&I@7_no07{f6CtO@?Gt_YtWyvr@BtWN0hlrqlPnck1HzDA{uUOqi4)%A)sb y{JIM5WzzmH>Zb=fft3H-ANB4>t5H4G>Lgxq2NHl zA8xmHI-zqDrbEarynOHbzC6PF_N$Lo=~wT;IR4>HL@}D4bn7(`3DZ)Ke0X&=lkjx=Q)-R!z3JSZ&#K$IGNlPc&?r8ohZNrpNz-e24Z_)g=*b`@BZ%|bMSdJVO+cq^{^?rYWrj^a45eN@oXXpd^vhQzZNcgedT4R zE?yCMJe KhI|K&oefXECdlvr diff --git a/tmp/cache/assets/sprockets/v3.0/W3/W3XwAgCDFRvYhwwVJYKQKtCyVDpRXlmZqdMgJh-LVoc.cache b/tmp/cache/assets/sprockets/v3.0/W3/W3XwAgCDFRvYhwwVJYKQKtCyVDpRXlmZqdMgJh-LVoc.cache index 0e5ad6dac16243772e85bcf082b68050b2979b26..7ea36e710c56209ddd66c87c66064a075d64280a 100644 GIT binary patch delta 49 zcmaFJxRsfOg(I4MBFkOHd}{_aYqnZ0PbG=eyt2%q{Jh-Myb|5A)S}|d{5&>m_KA9% E0bVT+Jpcdz delta 12 TcmdnW{E(4_g(I46BFkL>7GDE? diff --git a/tmp/cache/assets/sprockets/v3.0/ZQ/ZQYxGQY2STbcRAs7r9zuzaFu2FiuxFjYpR5VNKDVLSw.cache b/tmp/cache/assets/sprockets/v3.0/ZQ/ZQYxGQY2STbcRAs7r9zuzaFu2FiuxFjYpR5VNKDVLSw.cache index 96e3dbd5cc41d8e3ce30aaabe9703c0cf67f6fbc..548dcf8a0299f0a5919bf7ac3e15a9fabbf0caa7 100644 GIT binary patch delta 49 zcmZo<`pV40!V%3rk>#&qzBL1zHCrv0r;QeqL^BUWsm5YEf}!ejb}O`$WCV E09>69UH||9 delta 12 Tcmey$+{nbj!V%3jk>xJ{703gB diff --git a/tmp/cache/assets/sprockets/v3.0/a5/a5y0qRqBzEvvbtoPuwvQ0U2GWos07uF61KBhrc84AYE.cache b/tmp/cache/assets/sprockets/v3.0/a5/a5y0qRqBzEvvbtoPuwvQ0U2GWos07uF61KBhrc84AYE.cache index 236c00213b3066b045a8d96839d6e50ae952eb3a..2feb956ff8520c9ef97ff5d4f9b5cd78b09ac690 100644 GIT binary patch delta 51 zcmX@e^p%B$g(I4MBa1DgV!ky4n>AZ4m#30MYF=4pQGQ--YF>$MS!z*nW_})qoApigX diff --git a/tmp/cache/assets/sprockets/v3.0/mk/mkaRvyBfz78SdVFWZ7FVU21qOXOZgQ_Z8K4QKkC7qRA.cache b/tmp/cache/assets/sprockets/v3.0/mk/mkaRvyBfz78SdVFWZ7FVU21qOXOZgQ_Z8K4QKkC7qRA.cache index 7acbbdb50c6981daf297bc266f8674e67a0238a6..1aca0e5a9ac743f54b1ca33ce4171bbc9d055aca 100644 GIT binary patch delta 12 Tcmcb}agk$!2&3^vQ5zNj95Mru delta 12 Tcmcb}agk$!2&2(PQ5zNj94!No