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 @@
- <%= link_to new_item_path do %>出品<% end %>
- <%= link_to '/wants/home' do %>欲しいもの掲示板<% end %>
+ - <%= link_to '/password_reference/ref_home' do %>パスワード照会<% end %>
- <%= link_to '/usage' do %>使い方<% end %>
- <%= link_to '/about' do %>つくByeBuyについて<% end %>
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 5c350e6..274a679 100644
Binary files a/tmp/cache/assets/sprockets/v3.0/1T/1Tw4pIkMHZjSmmPj4R3UdV9M0_Rrl6QOWR8yxVQQlrU.cache and b/tmp/cache/assets/sprockets/v3.0/1T/1Tw4pIkMHZjSmmPj4R3UdV9M0_Rrl6QOWR8yxVQQlrU.cache differ
diff --git a/tmp/cache/assets/sprockets/v3.0/HC/HCDOUd7-S45aJ_PjVAC_Vmjyud3i1aQv4cE3t9_Z3Dw.cache b/tmp/cache/assets/sprockets/v3.0/HC/HCDOUd7-S45aJ_PjVAC_Vmjyud3i1aQv4cE3t9_Z3Dw.cache
index 72141c0..af685dc 100644
Binary files a/tmp/cache/assets/sprockets/v3.0/HC/HCDOUd7-S45aJ_PjVAC_Vmjyud3i1aQv4cE3t9_Z3Dw.cache and b/tmp/cache/assets/sprockets/v3.0/HC/HCDOUd7-S45aJ_PjVAC_Vmjyud3i1aQv4cE3t9_Z3Dw.cache differ
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 0e5ad6d..7ea36e7 100644
Binary files a/tmp/cache/assets/sprockets/v3.0/W3/W3XwAgCDFRvYhwwVJYKQKtCyVDpRXlmZqdMgJh-LVoc.cache and b/tmp/cache/assets/sprockets/v3.0/W3/W3XwAgCDFRvYhwwVJYKQKtCyVDpRXlmZqdMgJh-LVoc.cache differ
diff --git a/tmp/cache/assets/sprockets/v3.0/ZQ/ZQYxGQY2STbcRAs7r9zuzaFu2FiuxFjYpR5VNKDVLSw.cache b/tmp/cache/assets/sprockets/v3.0/ZQ/ZQYxGQY2STbcRAs7r9zuzaFu2FiuxFjYpR5VNKDVLSw.cache
index 96e3dbd..548dcf8 100644
Binary files a/tmp/cache/assets/sprockets/v3.0/ZQ/ZQYxGQY2STbcRAs7r9zuzaFu2FiuxFjYpR5VNKDVLSw.cache and b/tmp/cache/assets/sprockets/v3.0/ZQ/ZQYxGQY2STbcRAs7r9zuzaFu2FiuxFjYpR5VNKDVLSw.cache differ
diff --git a/tmp/cache/assets/sprockets/v3.0/a5/a5y0qRqBzEvvbtoPuwvQ0U2GWos07uF61KBhrc84AYE.cache b/tmp/cache/assets/sprockets/v3.0/a5/a5y0qRqBzEvvbtoPuwvQ0U2GWos07uF61KBhrc84AYE.cache
index 236c002..2feb956 100644
Binary files a/tmp/cache/assets/sprockets/v3.0/a5/a5y0qRqBzEvvbtoPuwvQ0U2GWos07uF61KBhrc84AYE.cache and b/tmp/cache/assets/sprockets/v3.0/a5/a5y0qRqBzEvvbtoPuwvQ0U2GWos07uF61KBhrc84AYE.cache differ
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 7acbbdb..1aca0e5 100644
Binary files a/tmp/cache/assets/sprockets/v3.0/mk/mkaRvyBfz78SdVFWZ7FVU21qOXOZgQ_Z8K4QKkC7qRA.cache and b/tmp/cache/assets/sprockets/v3.0/mk/mkaRvyBfz78SdVFWZ7FVU21qOXOZgQ_Z8K4QKkC7qRA.cache differ