<commit_before>module Users
  class Create < Mutations::Command
    required do
      string :name
      string :email
      string :password
      string :password_confirmation
    end

    def validate
      if password != password_<PASSWORD>
        add_error :password, :*, 'Password and confirmation do not match.'
      end
    end

    def execute
      user   = User.create!(email:                 email.downcase,
                            password:              password,
                            password_confirmation: <PASSWORD>,
                            name:                  name)
      device = Devices::Create.run!(user: user)
      UserMailer.welcome_email(user).deliver_later
      {message: "Check your email!"}
    end
  end
end<commit_msg>Fix 500 error when registering pre-existing accounts on accident<commit_after>module Users
  class Create < Mutations::Command
    required do
      string :name
      string :email
      string :password
      string :password_confirmation
    end

    def validate
      add_error :email, :*, 'Already registered' if User.find_by(email: email)
      if password != <PASSWORD>
        add_error :password, :*, 'Password and confirmation do not match.'
      end
    end

    def execute
      user   = User.create!(email:                 email.downcase,
                            password:              password,
                            password_confirmation: <PASSWORD>,
                            name:                  name)
      device = Devices::Create.run!(user: user)
      UserMailer.welcome_email(user).deliver_later
      {message: "Check your email!"}
    end
  end
end
{'fraction_non_alphanumeric': 0.07362703681351841, 'fraction_numerical': 0.0018105009052504525, 'mean_word_length': 1.713584288052373, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6317874', 'n_tokens_mistral': 423, 'n_tokens_neox': 407, 'n_words': 120}