simple-login / app

The SimpleLogin back-end and web app
https://simplelogin.io
GNU Affero General Public License v3.0
5.08k stars 430 forks source link

Still seeing three numbers in random suffix for custom domain #1709

Open utf8please opened 1 year ago

utf8please commented 1 year ago

Prerequisites

Bug report

Describe the bug

1670 seems to make the suffix shorter for custom domains (1 word only compared to 1 word + 3 digits). However, when I create a random alias on app.simplelogin.io, it still generates in the format of word_word123@mydomain.example.com.

Detailed steps:

  1. In Settings > Aliases, set "Based on Random Words", (my domain), "Random word from our dictionary" in that order
  2. On the dashboard page, click on the green "Random Alias" button (or the dropdown "By Random Words")

The same behavior can be observed through the API as well. I tried looking through the code but I cannot find any obvious causes -- I'm not familiar with the code base.

Expected behavior

It should generate aliases in the format of word_word@mydomain.example.com instead.

Screenshots If applicable, add screenshots to help explain your problem.

Environment (If applicable):

Additional context

Two months ago, the format was word_word@. After #1625, the format became wordword123@ and I verified that is indeed the case last month. I did not observe any behavior change due to #1670 but I now see the extra underscore introduced by #1673 (word_word123@) so I assume this has been pushed to app.simplelogin.io in v4.24.0.

Unfortunately, I do not have a self-hosted instance to play with or troubleshoot and I find it quite hard to determine what version is running on app.simplelogin.io. It would be nice if the version number can be included on a corner of the page.

purple-emily commented 1 year ago

Can I add to this comment that I WANT three numbers in the suffix of my custom domain. Can this be an option??

Raekye commented 1 year ago

I was also curious about this (er, frustrated that the setting "use random word for suffix" didn't work as advertised :sweat_smile: - where were the numbers coming from?), and did some digging.

Creating a random alias via the dashboard calls Alias.create_new_random: index.py.

Creating a random alias via the API also seems to call Alias.create_new_random (see note below for nuances): new_random_alias.py.

Alias.create_new_random calls generate_random_alias_email for both custom domains and SL domains: models.py.

generate_random_alias_email calls random_words(2, 3): see models.py, which explains the current behaviour; you get 2 words and 3 digits.


https://github.com/simple-login/app/pull/1670 modifies get_random_alias_suffix which is called by get_alias_suffixes in alias_suffix.py. get_alias_suffixes does get used by the API (new_random_alias.py); however, for custom domains, get_alias_suffixes only actually uses get_random_alias_suffix if random prefix generation is enabled. In any case, it doesn't seem like creating a random alias via the dashboard touches the code path changed by https://github.com/simple-login/app/pull/1670.

Raekye commented 1 year ago

Also something maybe worth noting/being clear about: based on the code path from Alias.create_new_random (which is always used by the dashboard, and conditionally by the API), as far as I can tell - the default suffix generator setting has no effect; either a UUID is used, or 2 random words + 3 digits are used.

wohfab commented 8 months ago

Can we have an update on this one? It is really frustrating, the setting doesn't do what it is supposed to.