# New signup with old email including + doesnt work in rest API

**URL:** https://meta.discourse.org/t/new-signup-with-old-email-including-doesnt-work-in-rest-api/267594
**Category:** Support
**Created:** [June 7, 2023, 8:39pm UTC](https://meta.discourse.org/t/new-signup-with-old-email-including-doesnt-work-in-rest-api/267594 "2023-06-07T20:39:29Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [June 7, 2023, 8:39pm UTC](https://meta.discourse.org/t/new-signup-with-old-email-including-doesnt-work-in-rest-api/267594/1 "2023-06-07T20:39:30Z")

</div>

It seems in a recent update, new signup with same email including a + to represent a new email isnt allowed. my system is highly dependent on it. how to enable it again?

for example if I have already signup with [email@gmail.com](mailto:email@gmail.com), I cant signup with [email+1@gmail.com](mailto:email+1@gmail.com)

btw I am testing this with rest api

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/a/0/da0ba32d9c19d6d37b94ec2269a899ead987cb7c.png)

also, I dont have this option checked:

 ![image](https://global.discourse-cdn.com/meta/original/4X/7/3/0/7302155deb3274edaa6ae66e1db33dba70a7d538.png)

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 7, 2023, 8:47pm UTC](https://meta.discourse.org/t/new-signup-with-old-email-including-doesnt-work-in-rest-api/267594/2 "2023-06-07T20:47:15Z")

</div>

I believe that’s the `normalize emails` admin setting: 👍

 ![image](https://global.discourse-cdn.com/meta/original/4X/0/6/f/06fa55aca655d364cab65c7b7d4743827b655a8e.png)

**Edit:** I did not see that edit before I posted. 🙂

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [June 7, 2023, 8:47pm UTC](https://meta.discourse.org/t/new-signup-with-old-email-including-doesnt-work-in-rest-api/267594/3 "2023-06-07T20:47:51Z")

</div>

> [@JammyDodger](#):
>
> I believe that’s the `normalize emails` admin setting: 👍

yes it is already disabled for me

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [June 7, 2023, 9:03pm UTC](https://meta.discourse.org/t/new-signup-with-old-email-including-doesnt-work-in-rest-api/267594/4 "2023-06-07T21:03:37Z")

</div>

I can’t duplicate this on [try.discourse.org](http://try.discourse.org).

Can you sign up from the normal UI with this email?

Also, can you double check the `+1` email wasn’t already used for a signup?

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [June 7, 2023, 9:11pm UTC](https://meta.discourse.org/t/new-signup-with-old-email-including-doesnt-work-in-rest-api/267594/5 "2023-06-07T21:11:29Z")

</div>

yes normal UI is ok. rest api is not ok.

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [June 7, 2023, 9:47pm UTC](https://meta.discourse.org/t/new-signup-with-old-email-including-doesnt-work-in-rest-api/267594/6 "2023-06-07T21:47:54Z")

</div>

I did exactly the same and could not duplicate the problem on the latest code running live - it behaved as expected with the `normalize emails` setting disabled:

> ![image](https://global.discourse-cdn.com/meta/original/4X/e/c/5/ec556b68a02ab53be7b69d9cfc74c2e15f85c16b.png)

Can you show the output of these from the rails console:

```plaintext
[1] pry(main)> SiteSetting.normalize_emails

[2] pry(main)> User.find_by_email('YOURUSERNAME@gmail.com').username

[3] pry(main)> User.find_by_email('YOURUSERNAME+1@gmail.com').username

```

Also, what version of Discourse are you on?

I might also double check you’re hitting your production site and not your test one (or vice versa).

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [June 7, 2023, 10:16pm UTC](https://meta.discourse.org/t/new-signup-with-old-email-including-doesnt-work-in-rest-api/267594/7 "2023-06-07T22:16:00Z")

</div>

> [@supermathie](#):
>
> Also, what version of Discourse are you on?

I updated right now

> [@supermathie](#):
>
> Can you show the output of these from the rails console:

here it is

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/d/a/4dad4d096ce4821ba7674ecfde02032d6617bed8.jpeg)

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [June 7, 2023, 10:21pm UTC](https://meta.discourse.org/t/new-signup-with-old-email-including-doesnt-work-in-rest-api/267594/8 "2023-06-07T22:21:02Z")

</div>

What do these translate to?

> ![image](https://global.discourse-cdn.com/meta/original/4X/9/b/4/9b4471c58cbf08d5ae5ab07c59dac88296ae6efd.png)

(and can you copy/paste them here)

I should have asked this first 🤦‍♂️

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [June 7, 2023, 10:34pm UTC](https://meta.discourse.org/t/new-signup-with-old-email-including-doesnt-work-in-rest-api/267594/9 "2023-06-07T22:34:37Z")

</div>

![image](https://global.discourse-cdn.com/meta/original/4X/3/0/5/305df885356c6b9d9107565d12f65a2df9004363.png)

“Primary email is not allowed.”  
it is a translation for user.email.blocked

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [June 7, 2023, 10:37pm UTC](https://meta.discourse.org/t/new-signup-with-old-email-including-doesnt-work-in-rest-api/267594/10 "2023-06-07T22:37:49Z")

</div>

hmmm

it seems the normalized email is blocked. 🤔

I mean if [email@gmail.com](mailto:email@gmail.com) is blocked, then [email+1@gmail.com](mailto:email+1@gmail.com) is blocked too. it is wierd to me when I have not normalized email option selected.

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [June 7, 2023, 10:43pm UTC](https://meta.discourse.org/t/new-signup-with-old-email-including-doesnt-work-in-rest-api/267594/11 "2023-06-07T22:43:30Z")

</div>

That’s why I should have asked first instead of assuming it was “already taken” 🤣

What are your overridden settings in the email and user categories?

Have you blocked that email address, or, say, the Gmail domain?

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [June 7, 2023, 10:51pm UTC](https://meta.discourse.org/t/new-signup-with-old-email-including-doesnt-work-in-rest-api/267594/12 "2023-06-07T22:51:37Z")

</div>

> [@supermathie](#):
>
> What are your overridden settings in the email and user categories?

I didnt underestand this. where should I check?

> [@supermathie](#):
>
> Have you blocked that email address, or, say, the Gmail domain?

yes I can see the normalized email is blocked.

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [June 7, 2023, 11:00pm UTC](https://meta.discourse.org/t/new-signup-with-old-email-including-doesnt-work-in-rest-api/267594/13 "2023-06-07T23:00:17Z")

</div>

> [@hosna](#):
>
> yes I can see the normalized email is blocked.

In this case we almost definitely block subaddresses of blocked addresses regardless of the setting as an anti-griefing measure since the normalisation option is not the default.

> [@hosna](#):
>
> where should I check

“Only show overridden” in settings. But now I suspect we don’t need to worry about that.

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [June 8, 2023, 12:55am UTC](https://meta.discourse.org/t/new-signup-with-old-email-including-doesnt-work-in-rest-api/267594/14 "2023-06-08T00:55:35Z")

</div>

Back at my desk I took a look at the actual code that does this rejection:

> <https://github.com/discourse/discourse/blob/699f3e701471ad794994c665aa63916d832b27de/app/models/screened_email.rb#L32>

Right at the top we’re checking the canonical email against the blocklist:

```ruby
  def self.canonical(email)
    name, domain = email.split("@", 2)
    name = name.gsub(/\+.*/, "")
    name = name.gsub(".", "") if %w[gmail.com googlemail.com].include?(domain.downcase)
    "#{name}@#{domain}".downcase
  end

```

And even if that didn’t catch it, it would be caught by the [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) check here:

```plaintext
[1] pry(main)> ScreenedEmail.levenshtein('fakezabanshenas@gmail.com', 'fakezabanshenas+1@gmail.com')
=> 2

```

as the default for `SiteSetting.levenshtein_distance_spammer_emails` is `2`.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [July 8, 2023, 12:56am UTC](https://meta.discourse.org/t/new-signup-with-old-email-including-doesnt-work-in-rest-api/267594/15 "2023-07-08T00:56:02Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
