Remove unused logic for checking unregistered user

This commit is contained in:
wandji20
2024-10-30 22:53:02 +01:00
parent ca82f62ea2
commit 44b4c29b77
4 changed files with 2 additions and 33 deletions

View File

@@ -25,20 +25,6 @@ module Spree
@unconfirmed_email = spree_current_user.unconfirmed_email
end
# Endpoint for queries to check if a user is already registered
def registered_email
registered = Spree::User.find_by(email: params[:email]).present?
if registered
respond_to do |format|
format.html { head :ok }
format.turbo_stream { :registered_email }
end
else
head :not_found
end
end
def create
@user = Spree::User.new(user_params)

View File

@@ -39,7 +39,7 @@ class UserPasswordsController < Spree::UserPasswordsController
end
def user_unconfirmed?
@user = Spree::User.find_by(email: params.dig(:spree_user, :email))
@user && !@user.confirmed?
user = Spree::User.find_by(email: params.dig(:spree_user, :email))
user && !user.confirmed?
end
end

View File

@@ -16,7 +16,6 @@ Openfoodnetwork::Application.routes.draw do
get "/register", to: "registration#index", as: :registration
get "/register/auth", to: "registration#authenticate", as: :registration_auth
post "/user/registered_email", to: "spree/users#registered_email"
resources :locales, only: [:show]
# Redirects to global website

View File

@@ -55,22 +55,6 @@ RSpec.describe Spree::UsersController, type: :controller do
end
end
describe "#registered_email" do
routes { Openfoodnetwork::Application.routes }
let!(:user) { create(:user) }
it "returns ok (200) if email corresponds to a registered user" do
post :registered_email, params: { email: user.email }
expect(response).to have_http_status(:ok)
end
it "returns not_found (404) if email does not correspond to a registered user" do
post :registered_email, params: { email: 'nonregistereduser@example.com' }
expect(response).to have_http_status(:not_found)
end
end
describe '#load_object' do
it 'redirects to signup path if user is not found' do
allow(controller).to receive_messages(spree_current_user: nil)