Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement/12 words sanitize #816

Merged
merged 9 commits into from
Aug 24, 2022
Merged

Conversation

henriquecbuss
Copy link
Member

@henriquecbuss henriquecbuss commented Aug 18, 2022

What issue does this PR close

Closes #815

Changes Proposed ( a list of new changes introduced by this PR)

  • Lowercase the 12 words
  • Use bip39 to validate the words. It'll be much easier to spot typos!
  • Include the Bip39 Portuguese wordlist. Users can now have their 12 words in Portuguese!
  • Fix usage of bip39 Spanish wordlist. Users can now have their 12 words in Spanish!

How to test ( a list of instructions on how to test this PR)

  • Go to the login page
  • Try to login with your regular words, but make parts of it uppercase
  • Write 12 random words and see how many bip39 words you can guess 😉
  • Create an account with the app in Spanish. Make sure your 12 words are in Spanish. Do the same for portuguese

@netlify
Copy link

netlify bot commented Aug 18, 2022

Deploy Preview for cambiatus-elm-book ready!

Name Link
🔨 Latest commit 6f566c5
🔍 Latest deploy log https://app.netlify.com/sites/cambiatus-elm-book/deploys/6303ae8c6f1f3d0008f61ec9
😎 Deploy Preview https://deploy-preview-816--cambiatus-elm-book.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Aug 18, 2022

Deploy done!

Name Link
🔨 Latest commit 6f566c5
🔍 Latest deploy log https://app.netlify.com/sites/cambiatus/deploys/6303ae8c34441c00084856d3
😎 Deploy Preview https://deploy-preview-816--cambiatus.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@henriquecbuss henriquecbuss requested a review from lucca65 August 18, 2022 23:13
Copy link
Member

@lucca65 lucca65 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bro, just remembered that at some point, long ago we've started supporting creating 12 words in Spanish. I think it was done here: #306

If this is still working, we should support Spanish words too on the validation.

To be honest this might even be a good place to actually support Portuguese as it was approved a few months after we've added Spanish support: https://bitcointalk.org/index.php?topic=5272106.0

What do you think? this might be a great hidden feature!

Also on another note, do you think we could add highlight to the wrong word? a google search showed this article that comes with a lib that could be easy to include or implement: https://codersblock.com/blog/highlight-text-inside-a-textarea/

@henriquecbuss
Copy link
Member Author

I had no idea we supported Spanish mnemonics 🤯

Those are some great ideas, I'll work on it 💪

@henriquecbuss
Copy link
Member Author

@lucca65 I fixed spanish mnemonics, added Portuguese ones, and added highlighting to words that aren't in any of those lists ✅

We could do a few more things:

  • Detect which list is more likely to be the one the user created their account with (analyzing the correct words, or the "distance" between each list and the input)
  • Suggest or even auto correct some words

I think those would take some extra time to do, so I haven't done them in this PR. If you think it would be nice to have those things, we could have another PR to do them. What do you think?

@henriquecbuss henriquecbuss requested a review from lucca65 August 22, 2022 13:14
Copy link
Member

@lucca65 lucca65 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn, I can't believe how amazing this looks. Seriously I loved this changes!!! My mind is blown!!

I've spotted two problems, however

  1. After the change, looks like the paste button is no longer working on safari desktop
  2. When I try to create a new account on Mizu, I gives me an error because 0,CMB don't accept invites. I've tried it on staging and its working, so I guess something's up with Netlify
  3. So I've deployed this branch to staging, but when creating an account with ptBr selected it didn't generated with right lang. Maybe its because its matching to pt instead of ptBr (or similar)?

Captura de Tela 2022-08-22 às 13 04 10

I'm excited about this PR, looks amazing bro!

@henriquecbuss
Copy link
Member Author

After the change, looks like the paste button is no longer working on safari desktop

Fixed ✅

When I try to create a new account on Mizu, I gives me an error because 0,CMB don't accept invites. I've tried it on staging and its working, so I guess something's up with Netlify

Ever since we started using community from the graphql context, we've been having some similar bugs. I have some ideas to fix them, I'll open an issue later. This only happens when we don't use subdomains, so it's ok for prod.

So I've deployed this branch to staging, but when creating an account with ptBr selected it didn't generated with right lang. Maybe its because its matching to pt instead of ptBr (or similar)?

Did you do yarn install? I had to upgrade the bip39 package to a version with the Portuguese wordlist, so if we were using the older version, it would make sense that it would use the English one (which is the default). Otherwise, that's weird... On my tests, the locale was pt-br, es-es, etc. I've changed the logic on how we detect the language and ran yarn install, can you try it again?

@lucca65
Copy link
Member

lucca65 commented Aug 22, 2022

I did run yarn... I've also changed the node version, maybe that's affecting, I'll delete node_modules and try again.

@lucca65
Copy link
Member

lucca65 commented Aug 22, 2022

ok, done. Still the same result on staging 🤔

@henriquecbuss
Copy link
Member Author

Maybe there's some really specific edge case where the locale in Elm and in JS are getting out of sync... I really can't see how that could happen though, and I can't replicate it... Can you share what your cookies look like on staging? If you try with Spanish, does it work?

It's working fine for me:
image

image

@lucca65
Copy link
Member

lucca65 commented Aug 22, 2022

Maybe this is related to asset caching from my browser? Just cleaned everything and tried again... it worked. Maybe we need to include some cache invalidation logic? 🤔

Here it is my cookies before cleaning my cache and cookies
Captura de Tela 2022-08-22 às 17 33 06

Copy link
Member

@lucca65 lucca65 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bro, cache issues are a pain

There are only two hard problems in computer science: Cache invalidation and Naming things

This PR looks awesome! I'll include it on our release right away!

@henriquecbuss
Copy link
Member Author

Yeah, I really don't know what could it be 😅. The locale in your cookies looks ok, and Elm should pick it up when starting the app. Changing it while using the app also should change cookies, so I don't know.

@juramos-2020
Copy link

Oi @NeoVier

Você pode me explicar melhor oq devo fazer aqui 👇 o que são os "bip39 words"? O que devo ver?

"Write 12 random words and see how many bip39 words you can guess"

@henriquecbuss
Copy link
Member Author

Esse bip39 é a lista de palavras possíveis para serem usadas nas suas 12 palavras. Se você tentar alguma palavra que não está nessa lista, deve aparecer um erro quando tentar fazer o submit

@juramos-2020
Copy link

  • "Try to login with your regular words, but make parts of it uppercase"

Ok, consegui fazer o login normalmente, mesmo com algumas letras maiúsculas

  • "Write 12 random words and see how many bip39 words you can guess"

Ok, escrevi uma palavra errada e não consegui fazer o login

  • Create an account with the app in Spanish. Make sure your 12 words are in Spanish. Do the same for portuguese

Ok, consegui criar minha conta em ES e PT-BR gerando as 12 palavras nos respectivos idiomas

Obs:
Nesse último teste usei esse link (https://ccon.staging.cambiatus.io/login) pois o link do deploy ( https://deploy-preview-816--cambiatus.netlify.app/login?redirect=%2Fdashboard ) não aparece o texto de "Ainda não tem uma conta? Crie agora!" Na tela de login.

Screenshot_2022-08-24-15-17-41-831_com.android.chrome.jpg

Screenshot_2022-08-24-15-16-13-205_com.android.chrome.jpg

Também vi um erro ao criar meu nome de usuário na CCON. Escrevi o nome errado faltando os números. Com isso deveria aparecer um feedback de erro. Porém esse feedback de erro não apareceu. A tela apenas travou e eu não consegui finalizar a criação da conta.

@henriquecbuss
Copy link
Member Author

Nesse último teste usei esse link (https://ccon.staging.cambiatus.io/login) pois o link do deploy ( https://deploy-preview-816--cambiatus.netlify.app/login?redirect=%2Fdashboard ) não aparece o texto de "Ainda não tem uma conta? Crie agora!" Na tela de login.

Esse link aponta pra comunidade 0,CMB, que não aceita novos membros sem convite. Por causa disso, o link de criar conta não deve aparecer mesmo

Também vi um erro ao criar meu nome de usuário na CCON. Escrevi o nome errado faltando os números. Com isso deveria aparecer um feedback de erro. Porém esse feedback de erro não apareceu. A tela apenas travou e eu não consegui finalizar a criação da conta.

Pode criar uma issue pra isso, @juramos-2020? Desvia um pouco do que estamos tentando resolver nesse PR, então acho que ficaria melhor resolver em um separado.

@henriquecbuss
Copy link
Member Author

Como o que é relacionado a esse PR foi aprovado, vou mergear 😁

@henriquecbuss henriquecbuss merged commit 0bbd2d7 into master Aug 24, 2022
@henriquecbuss henriquecbuss deleted the enhancement/12-words-sanitize branch August 24, 2022 18:40
@juramos-2020
Copy link

Beleza crio sim 😉🤟

Tudo certo então 🧞✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sanitize 12 words input
3 participants