Skip to content

Commit

Permalink
Merge pull request #33 from laruby2/bugfix
Browse files Browse the repository at this point in the history
BugFix: removing phone number from session when signup cancel
  • Loading branch information
kangkyu authored Aug 9, 2024
2 parents 93d397d + a5ae36c commit 9ba6e5b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/controllers/phone_numbers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ def edit
def new
end

def destroy
session[:telephone] = nil
redirect_to root_url
end

private

def client
Expand Down
8 changes: 7 additions & 1 deletion app/views/users/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<div class="relative flex flex-grow items-stretch focus-within:z-10">
<%= f.phone_field :phone_number, disabled: true, placeholder: "(555) 987-6543", class: "bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" %>
</div>
<%= f.submit "Verify", disabled: true, formaction: phone_numbers_verify_path, class: "relative -ml-px inline-flex items-center gap-x-1.5 rounded-r-md px-3 py-2 text-sm font-semibold text-gray-900 ring-1 ring-inset ring-gray-300 hover:bg-gray-50" %>
<p class="relative -ml-px inline-flex items-center gap-x-1.5 rounded-r-md px-3 py-2 text-sm font-semibold bg-orange-500 text-white ring-1 ring-inset ring-orange-300">&#x2713;</p>
</div>
</div>
</div>
Expand All @@ -40,3 +40,9 @@
</div>
</div>
<% end %>

<div class="mb-6 px-6 max-w-3xl mx-auto lg:ml-0 lg:mr-auto xl:mx-0 xl:px-12 xl:w-3/4">

<hr class="my-8 border-b-2 border-gray-200">
<%= button_to "Cancel", phone_numbers_delete_path, method: :delete, class: "py-2 px-4 border border-gray-500 rounded text-gray-500 hover:bg-gray-100 hover:border-gray-700 hover:text-gray-700 font-bold" %>
</div>
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
post 'phone_numbers/verify' => "phone_numbers#verify"
get 'phone_numbers/passcode' => "phone_numbers#edit"
post 'phone_numbers/passcode' => "phone_numbers#passcode_enter"
delete 'phone_numbers/delete' => "phone_numbers#destroy"

resource :session, only: [:new, :create, :destroy]
get "signin" => "sessions#new"
Expand Down

0 comments on commit 9ba6e5b

Please sign in to comment.