Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/assets/log_file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
************************
2018-12-03 09:57:33 +0900
<仮出品完了>
商品ID:
商品名: a
場所ID:
商品画像:
商品価格:
商品詳細:
ジャンルID:
出品者学籍番号:
2 changes: 1 addition & 1 deletion app/controllers/items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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回目のアクセス -> 失敗を通知、ユーザ登録ページのリンクを貼る
Expand Down
48 changes: 48 additions & 0 deletions app/controllers/password_reference_controller.rb
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<ul class="right hide-on-med-and-down">
<li><%= link_to new_item_path do %>出品<% end %></li>
<li><%= link_to '/wants/home' do %>欲しいもの掲示板<% end %></li>
<li><%= link_to '/password_reference/ref_home' do %>パスワード照会<% end %></li>
<li><%= link_to '/usage' do %>使い方<% end %></li>
<li><%= link_to '/about' do %>つくByeBuyについて<% end %></li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion app/views/mail_page/done.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ https://a2-autumn.herokuapp.com/items/" + @item.id.to_s + "
==========================
enPiT2017 チームA1
tsuku.byebuy@gmail.com
==========================
==========================
" %>
<% end %>

Expand Down
1 change: 1 addition & 0 deletions app/views/password_reference/do_ref_mail.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
メールを発送しました。<br>
10 changes: 10 additions & 0 deletions app/views/password_reference/ref_home.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<h1>パスワード照会</h1>
あなたの学籍番号を入力して送信ボタンを押してください。<br>
メールにてパスワードが送信されます。<br>
※このパスワード照会によってパスワードが変更されることはありません。<br>
※パスワードは学籍番号ごとに設定されており、同じ学籍番号であれば全ての出品に対して同じパスワードが利用できます。<br>

<%= form_tag('do_ref_mail', method: :post) do %>
<div><%= text_field_tag :student_id %></div>
<%= submit_tag "送信" %>
<% end %>
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 10 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.