diff --git a/app/controllers/phone_numbers_controller.rb b/app/controllers/phone_numbers_controller.rb index be7a1af..68ef771 100644 --- a/app/controllers/phone_numbers_controller.rb +++ b/app/controllers/phone_numbers_controller.rb @@ -74,6 +74,11 @@ def edit def new end + def destroy + session[:telephone] = nil + redirect_to root_url + end + private def client diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 9790b99..22766a0 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -21,7 +21,7 @@
<%= 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" %>
- <%= 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" %> +

@@ -40,3 +40,9 @@ <% end %> + +
+ +
+ <%= 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" %> +
diff --git a/config/routes.rb b/config/routes.rb index 2c086dd..f78a757 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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"