From 55f04906ac7d9131d43ce9b0c67bb1179805026e Mon Sep 17 00:00:00 2001
From: Benoit Marty <benoit@matrix.org>
Date: Fri, 4 Sep 2020 14:17:15 +0200
Subject: [PATCH 1/3] Correct markdown formatting

---
 docs/add_threePids.md |  4 ++--
 docs/signin.md        | 32 +++++++++++++++++++++-------
 docs/signup.md        | 49 +++++++++++++++++++++++++++++++------------
 3 files changed, 62 insertions(+), 23 deletions(-)

diff --git a/docs/add_threePids.md b/docs/add_threePids.md
index 98fcbbda6a..89fc92f329 100644
--- a/docs/add_threePids.md
+++ b/docs/add_threePids.md
@@ -261,11 +261,11 @@ This is not an ideal, but the client will display a hint to check the entered co
 
 200
 
-````json
+```json
 {
   "success": true
 }
-````
+```
 
 Then the app call `https://homeserver.org/_matrix/client/r0/account/3pid/add` as per adding an email and follow the same UIS flow
 
diff --git a/docs/signin.md b/docs/signin.md
index f5ec03e708..a75a46697d 100644
--- a/docs/signin.md
+++ b/docs/signin.md
@@ -8,7 +8,9 @@ This document describes the flow of signin to a homeserver, and also the flow wh
 
 Client request the sign-in flows, once the homeserver is chosen by the user and its url is known (in the example it's `https://matrix.org`)
 
-> curl -X GET 'https://matrix.org/_matrix/client/r0/login'
+```shell script
+curl -X GET 'https://matrix.org/_matrix/client/r0/login'
+```
 
 200
 
@@ -26,7 +28,9 @@ Client request the sign-in flows, once the homeserver is chosen by the user and
 
 The user is able to connect using `m.login.password`
 
-> curl -X POST --data $'{"identifier":{"type":"m.id.user","user":"alice"},"password":"weak_password","type":"m.login.password","initial_device_display_name":"Portable"}' 'https://matrix.org/_matrix/client/r0/login'
+```shell script
+curl -X POST --data $'{"identifier":{"type":"m.id.user","user":"alice"},"password":"weak_password","type":"m.login.password","initial_device_display_name":"Portable"}' 'https://matrix.org/_matrix/client/r0/login'
+```
 
 ```json
 {
@@ -73,7 +77,9 @@ We get credential (200)
 
 If the user has associated an email with its account, he can signin using the email.
 
-> curl -X POST --data $'{"identifier":{"type":"m.id.thirdparty","medium":"email","address":"alice@yopmail.com"},"password":"weak_password","type":"m.login.password","initial_device_display_name":"Portable"}' 'https://matrix.org/_matrix/client/r0/login'
+```shell script
+curl -X POST --data $'{"identifier":{"type":"m.id.thirdparty","medium":"email","address":"alice@yopmail.com"},"password":"weak_password","type":"m.login.password","initial_device_display_name":"Portable"}' 'https://matrix.org/_matrix/client/r0/login'
+```
 
 ```json
 {
@@ -136,7 +142,9 @@ Not supported yet in Element
 
 ### Login with SSO
 
-> curl -X GET 'https://homeserver.with.sso/_matrix/client/r0/login'
+```shell script
+curl -X GET 'https://homeserver.with.sso/_matrix/client/r0/login'
+```
 
 200
 
@@ -171,7 +179,9 @@ Once the process is finished, the web page will call the `redirectUrl` with an e
 
 This navigation is intercepted by Element by the `LoginActivity`, which will then ask the homeserver to convert this `loginToken` to an access token
 
-> curl -X POST --data $'{"type":"m.login.token","token":"MDAxOWxvY2F0aW9uIG1vemlsbGEub3JnCjAwMTNpZGVudGlmaWVy"}' 'https://homeserver.with.sso/_matrix/client/r0/login'
+```shell script
+curl -X POST --data $'{"type":"m.login.token","token":"MDAxOWxvY2F0aW9uIG1vemlsbGEub3JnCjAwMTNpZGVudGlmaWVy"}' 'https://homeserver.with.sso/_matrix/client/r0/login'
+```
 
 ```json
 {
@@ -214,7 +224,9 @@ We display a warning regarding e2e.
 
 At the first step, we do not send the password, only the email and a client secret, generated by the application
 
-> curl -X POST --data $'{"client_secret":"6c57f284-85e2-421b-8270-fb1795a120a7","send_attempt":0,"email":"user@domain.com"}' 'https://matrix.org/_matrix/client/r0/account/password/email/requestToken'
+```shell script
+curl -X POST --data $'{"client_secret":"6c57f284-85e2-421b-8270-fb1795a120a7","send_attempt":0,"email":"user@domain.com"}' 'https://matrix.org/_matrix/client/r0/account/password/email/requestToken'
+```
 
 ```json
 {
@@ -251,7 +263,9 @@ During this step, the new password is sent to the homeserver.
 
 If the user confirms before the link is clicked, we get an error:
 
-> curl -X POST --data $'{"auth":{"type":"m.login.email.identity","threepid_creds":{"client_secret":"6c57f284-85e2-421b-8270-fb1795a120a7","sid":"tQNbrREDACTEDldA"}},"new_password":"weak_password"}' 'https://matrix.org/_matrix/client/r0/account/password'
+```shell script
+curl -X POST --data $'{"auth":{"type":"m.login.email.identity","threepid_creds":{"client_secret":"6c57f284-85e2-421b-8270-fb1795a120a7","sid":"tQNbrREDACTEDldA"}},"new_password":"weak_password"}' 'https://matrix.org/_matrix/client/r0/account/password'
+```
 
 ```json
 {
@@ -285,7 +299,9 @@ It contains the client secret, a token and the sid
 
 When the user click the link, if validate his ownership and the new password can now be ent by the application (on user demand):
 
-> curl -X POST --data $'{"auth":{"type":"m.login.email.identity","threepid_creds":{"client_secret":"6c57f284-85e2-421b-8270-fb1795a120a7","sid":"tQNbrREDACTEDldA"}},"new_password":"weak_password"}' 'https://matrix.org/_matrix/client/r0/account/password'
+```shell script
+curl -X POST --data $'{"auth":{"type":"m.login.email.identity","threepid_creds":{"client_secret":"6c57f284-85e2-421b-8270-fb1795a120a7","sid":"tQNbrREDACTEDldA"}},"new_password":"weak_password"}' 'https://matrix.org/_matrix/client/r0/account/password'
+```
 
 ```json
 {
diff --git a/docs/signup.md b/docs/signup.md
index 995f5d50a6..7d5c8f450b 100644
--- a/docs/signup.md
+++ b/docs/signup.md
@@ -10,7 +10,9 @@ This document describes the flow of registration to a homeserver. Examples come
 
 Client request the sign-up flows, once the homeserver is chosen by the user and its url is known (in the example it's `https://matrix.org`)
 
-> curl -X POST --data $'{}' 'https://matrix.org/_matrix/client/r0/register'
+```shell script
+curl -X POST --data $'{}' 'https://matrix.org/_matrix/client/r0/register'
+```
 
 ```json
 {
@@ -70,7 +72,9 @@ If the registration is not possible, we get a 403
 
 The app is displaying a form to enter username and password.
 
-> curl -X POST --data $'{"initial_device_display_name":"Mobile device","username":"alice","password": "weak_password"}' 'https://matrix.org/_matrix/client/r0/register'
+```shell script
+curl -X POST --data $'{"initial_device_display_name":"Mobile device","username":"alice","password": "weak_password"}' 'https://matrix.org/_matrix/client/r0/register'
+```
 
 ```json
 {
@@ -135,7 +139,9 @@ We get a 400:
 
 User is proposed to enter an email. We skip this step.
 
-> curl -X POST --data $'{"auth":{"session":"xptUYoREDACTEDogOWAGVnbJQ","type":"m.login.dummy"}}' 'https://matrix.org/_matrix/client/r0/register'
+```shell script
+curl -X POST --data $'{"auth":{"session":"xptUYoREDACTEDogOWAGVnbJQ","type":"m.login.dummy"}}' 'https://matrix.org/_matrix/client/r0/register'
+```
 
 ```json
 {
@@ -193,7 +199,9 @@ User is proposed to enter an email. We skip this step.
 
 We request a token to the homeserver. The `client_secret` is generated by the application
 
-> curl -X POST --data $'{"client_secret":"53e679ea-oRED-ACTED-92b8-3012c49c6cfa","email":"alice@yopmail.com","send_attempt":0}' 'https://matrix.org/_matrix/client/r0/register/email/requestToken'
+```shell script
+curl -X POST --data $'{"client_secret":"53e679ea-oRED-ACTED-92b8-3012c49c6cfa","email":"alice@yopmail.com","send_attempt":0}' 'https://matrix.org/_matrix/client/r0/register/email/requestToken'
+```
 
 ```json
 {
@@ -213,7 +221,9 @@ We request a token to the homeserver. The `client_secret` is generated by the ap
 
 And
 
-> curl -X POST --data $'{"auth":{"threepid_creds":{"client_secret":"53e679ea-oRED-ACTED-92b8-3012c49c6cfa","sid":"qlBCREDACTEDEtgxD"},"session":"xptUYoREDACTEDogOWAGVnbJQ","type":"m.login.email.identity"}}' 'https://matrix.org/_matrix/client/r0/register'
+```shell script
+curl -X POST --data $'{"auth":{"threepid_creds":{"client_secret":"53e679ea-oRED-ACTED-92b8-3012c49c6cfa","sid":"qlBCREDACTEDEtgxD"},"session":"xptUYoREDACTEDogOWAGVnbJQ","type":"m.login.email.identity"}}' 'https://matrix.org/_matrix/client/r0/register'
+```
 
 ```json
 {
@@ -239,7 +249,9 @@ We get 401 since the email is not validated yet:
 
 The app is now polling on 
 
-> curl -X POST --data $'{"auth":{"threepid_creds":{"client_secret":"53e679ea-oRED-ACTED-92b8-3012c49c6cfa","sid":"qlBCREDACTEDEtgxD"},"session":"xptUYoREDACTEDogOWAGVnbJQ","type":"m.login.email.identity"}}' 'https://matrix.org/_matrix/client/r0/register'
+```shell script
+curl -X POST --data $'{"auth":{"threepid_creds":{"client_secret":"53e679ea-oRED-ACTED-92b8-3012c49c6cfa","sid":"qlBCREDACTEDEtgxD"},"session":"xptUYoREDACTEDogOWAGVnbJQ","type":"m.login.email.identity"}}' 'https://matrix.org/_matrix/client/r0/register'
+```
 
 ```json
 {
@@ -306,7 +318,9 @@ Once the link is clicked, the registration request (polling) returns a 401 with
 
 User is proposed to accept T&C and he accepts them
 
-> curl -X POST --data $'{"auth":{"session":"xptUYoREDACTEDogOWAGVnbJQ","type":"m.login.terms"}}' 'https://matrix.org/_matrix/client/r0/register'
+```shell script
+curl -X POST --data $'{"auth":{"session":"xptUYoREDACTEDogOWAGVnbJQ","type":"m.login.terms"}}' 'https://matrix.org/_matrix/client/r0/register'
+```
 
 ```json
 {
@@ -365,7 +379,9 @@ User is proposed to accept T&C and he accepts them
 
 User is proposed to prove he is not a robot and he does it:
 
-> curl -X POST --data $'{"auth":{"response":"03AOLTBLSiGS9GhFDpAMblJ2nlXOmHXqAYJ5OvHCPUjiVLBef3k9snOYI_BDC32-t4D2jv-tpvkaiEI_uloobFd9RUTPpJ7con2hMddbKjSCYqXqcUQFhzhbcX6kw8uBnh2sbwBe80_ihrHGXEoACXQkL0ki1Q0uEtOeW20YBRjbNABsZPpLNZhGIWC0QVXnQ4FouAtZrl3gOAiyM-oG3cgP6M9pcANIAC_7T2P2amAHbtsTlSR9CsazNyS-rtDR9b5MywdtnWN9Aw8fTJb8cXQk_j7nvugMxzofPjSOrPKcr8h5OqPlpUCyxxnFtag6cuaPSUwh43D2L0E-ZX7djzaY2Yh_U2n6HegFNPOQ22CJmfrKwDlodmAfMPvAXyq77n3HpoREDACTEDo3830RHF4BfkGXUaZjctgg-A1mvC17hmQmQpkG7IhDqyw0onU-0vF_-ehCjq_CcQEDpS_O3uiHJaG5xGf-0rhLm57v_wA3deugbsZuO4uTuxZZycN_mKxZ97jlDVBetl9hc_5REPbhcT1w3uzTCSx7Q","session":"xptUYoREDACTEDogOWAGVnbJQ","type":"m.login.recaptcha"}}' 'https://matrix.org/_matrix/client/r0/register'
+```shell script
+curl -X POST --data $'{"auth":{"response":"03AOLTBLSiGS9GhFDpAMblJ2nlXOmHXqAYJ5OvHCPUjiVLBef3k9snOYI_BDC32-t4D2jv-tpvkaiEI_uloobFd9RUTPpJ7con2hMddbKjSCYqXqcUQFhzhbcX6kw8uBnh2sbwBe80_ihrHGXEoACXQkL0ki1Q0uEtOeW20YBRjbNABsZPpLNZhGIWC0QVXnQ4FouAtZrl3gOAiyM-oG3cgP6M9pcANIAC_7T2P2amAHbtsTlSR9CsazNyS-rtDR9b5MywdtnWN9Aw8fTJb8cXQk_j7nvugMxzofPjSOrPKcr8h5OqPlpUCyxxnFtag6cuaPSUwh43D2L0E-ZX7djzaY2Yh_U2n6HegFNPOQ22CJmfrKwDlodmAfMPvAXyq77n3HpoREDACTEDo3830RHF4BfkGXUaZjctgg-A1mvC17hmQmQpkG7IhDqyw0onU-0vF_-ehCjq_CcQEDpS_O3uiHJaG5xGf-0rhLm57v_wA3deugbsZuO4uTuxZZycN_mKxZ97jlDVBetl9hc_5REPbhcT1w3uzTCSx7Q","session":"xptUYoREDACTEDogOWAGVnbJQ","type":"m.login.recaptcha"}}' 'https://matrix.org/_matrix/client/r0/register'
+```
 
 ```json
 {
@@ -398,7 +414,9 @@ On matrix.org, it's not required, and not even optional, but it's still possible
 
 The user enter a phone number and select a country, the `client_secret` is generated by the application
 
-> curl -X POST --data $'{"client_secret":"d3e285f6-972a-496c-9a22-7915a2db57c7","send_attempt":1,"country":"FR","phone_number":"+33611223344"}'  'https://matrix.org/_matrix/client/r0/register/msisdn/requestToken'
+```shell script
+curl -X POST --data $'{"client_secret":"d3e285f6-972a-496c-9a22-7915a2db57c7","send_attempt":1,"country":"FR","phone_number":"+33611223344"}'  'https://matrix.org/_matrix/client/r0/register/msisdn/requestToken'
+```
 
 ```json
 {
@@ -432,8 +450,9 @@ If it is not the case, the homeserver send the SMS and returns some data, especi
 
 When you execute the register request, with the received `sid`, you get an error since the MSISDN is not validated yet:
 
-> curl -X POST --data $'{"auth":{"type":"m.login.msisdn","session":"xptUYoREDACTEDogOWAGVnbJQ","threepid_creds":{"client_secret":"d3e285f6-972a-496c-9a22-7915a2db57c7","sid":"1678881798"}}}' 'https://matrix.org/_matrix/client/r0/register'
-
+```shell script
+curl -X POST --data $'{"auth":{"type":"m.login.msisdn","session":"xptUYoREDACTEDogOWAGVnbJQ","threepid_creds":{"client_secret":"d3e285f6-972a-496c-9a22-7915a2db57c7","sid":"1678881798"}}}' 'https://matrix.org/_matrix/client/r0/register'
+```
 
 ```json
   "auth": {
@@ -492,7 +511,9 @@ There is an issue on Synapse, which return a 401, it sends too much data along w
 
 The user receive the SMS, he can enter the SMS code in the app, which is sent using the "submit_url" received ie the response of the `requestToken` request:
 
-> curl -X POST --data $'{"client_secret":"d3e285f6-972a-496c-9a22-7915a2db57c7","sid":"1678881798","token":"123456"}' 'https://matrix.org/_matrix/client/unstable/add_threepid/msisdn/submit_token'
+```shell script
+curl -X POST --data $'{"client_secret":"d3e285f6-972a-496c-9a22-7915a2db57c7","sid":"1678881798","token":"123456"}' 'https://matrix.org/_matrix/client/unstable/add_threepid/msisdn/submit_token'
+```
 
 ```json
 {
@@ -520,7 +541,9 @@ And if the code is correct we get a 200 with:
 
 We can now execute the registration request, to the homeserver
 
-> curl -X POST --data $'{"auth":{"type":"m.login.msisdn","session":"xptUYoREDACTEDogOWAGVnbJQ","threepid_creds":{"client_secret":"d3e285f6-972a-496c-9a22-7915a2db57c7","sid":"1678881798"}}}' 'https://matrix.org/_matrix/client/r0/register'
+```shell script
+curl -X POST --data $'{"auth":{"type":"m.login.msisdn","session":"xptUYoREDACTEDogOWAGVnbJQ","threepid_creds":{"client_secret":"d3e285f6-972a-496c-9a22-7915a2db57c7","sid":"1678881798"}}}' 'https://matrix.org/_matrix/client/r0/register'
+```
 
 ```json
 {

From 2490d4d6388f466bce9b3593af8e7e88e8ce496b Mon Sep 17 00:00:00 2001
From: Benoit Marty <benoit@matrix.org>
Date: Fri, 4 Sep 2020 14:18:47 +0200
Subject: [PATCH 2/3] Generic email-provider hots.

---
 docs/signin.md | 4 ++--
 docs/signup.md | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/signin.md b/docs/signin.md
index a75a46697d..06f715c46b 100644
--- a/docs/signin.md
+++ b/docs/signin.md
@@ -78,7 +78,7 @@ We get credential (200)
 If the user has associated an email with its account, he can signin using the email.
 
 ```shell script
-curl -X POST --data $'{"identifier":{"type":"m.id.thirdparty","medium":"email","address":"alice@yopmail.com"},"password":"weak_password","type":"m.login.password","initial_device_display_name":"Portable"}' 'https://matrix.org/_matrix/client/r0/login'
+curl -X POST --data $'{"identifier":{"type":"m.id.thirdparty","medium":"email","address":"alice@email-provider.org"},"password":"weak_password","type":"m.login.password","initial_device_display_name":"Portable"}' 'https://matrix.org/_matrix/client/r0/login'
 ```
 
 ```json
@@ -86,7 +86,7 @@ curl -X POST --data $'{"identifier":{"type":"m.id.thirdparty","medium":"email","
   "identifier": {
     "type": "m.id.thirdparty",
     "medium": "email",
-    "address": "alice@yopmail.com"
+    "address": "alice@email-provider.org"
   },
   "password": "weak_password",
   "type": "m.login.password",
diff --git a/docs/signup.md b/docs/signup.md
index 7d5c8f450b..f8b0b24485 100644
--- a/docs/signup.md
+++ b/docs/signup.md
@@ -200,13 +200,13 @@ curl -X POST --data $'{"auth":{"session":"xptUYoREDACTEDogOWAGVnbJQ","type":"m.l
 We request a token to the homeserver. The `client_secret` is generated by the application
 
 ```shell script
-curl -X POST --data $'{"client_secret":"53e679ea-oRED-ACTED-92b8-3012c49c6cfa","email":"alice@yopmail.com","send_attempt":0}' 'https://matrix.org/_matrix/client/r0/register/email/requestToken'
+curl -X POST --data $'{"client_secret":"53e679ea-oRED-ACTED-92b8-3012c49c6cfa","email":"alice@email-provider.org","send_attempt":0}' 'https://matrix.org/_matrix/client/r0/register/email/requestToken'
 ```
 
 ```json
 {
   "client_secret": "53e679ea-oRED-ACTED-92b8-3012c49c6cfa",
-  "email": "alice@yopmail.com",
+  "email": "alice@email-provider.org",
   "send_attempt": 0
 }
 ```

From 82e3adebbce1a84044d9a8e524c24851717a5d59 Mon Sep 17 00:00:00 2001
From: Benoit Marty <benoit@matrix.org>
Date: Fri, 4 Sep 2020 14:23:56 +0200
Subject: [PATCH 3/3] Improve wording and fix typo

---
 docs/signup.md | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/docs/signup.md b/docs/signup.md
index f8b0b24485..97cd20a423 100644
--- a/docs/signup.md
+++ b/docs/signup.md
@@ -137,7 +137,7 @@ We get a 400:
 
 ### Step 2: entering email
 
-User is proposed to enter an email. We skip this step.
+User is proposed to enter an email. User skips this step.
 
 ```shell script
 curl -X POST --data $'{"auth":{"session":"xptUYoREDACTEDogOWAGVnbJQ","type":"m.login.dummy"}}' 'https://matrix.org/_matrix/client/r0/register'
@@ -195,7 +195,7 @@ curl -X POST --data $'{"auth":{"session":"xptUYoREDACTEDogOWAGVnbJQ","type":"m.l
 }
 ```
 
-### Step 2 bis: we enter an email
+### Step 2 bis: user enters an email
 
 We request a token to the homeserver. The `client_secret` is generated by the application
 
@@ -266,7 +266,7 @@ curl -X POST --data $'{"auth":{"threepid_creds":{"client_secret":"53e679ea-oRED-
 }
 ```
 
-We click on the link received by email `https://matrix.org/_matrix/client/unstable/registration/email/submit_token?token=vtQjQIZfwdoREDACTEDozrmKYSWlCXsJ&client_secret=53e679ea-oRED-ACTED-92b8-3012c49c6cfa&sid=qlBCREDACTEDEtgxD` which contains:
+User clicks on the link received by email `https://matrix.org/_matrix/client/unstable/registration/email/submit_token?token=vtQjQIZfwdoREDACTEDozrmKYSWlCXsJ&client_secret=53e679ea-oRED-ACTED-92b8-3012c49c6cfa&sid=qlBCREDACTEDEtgxD` which contains:
 - A `token` vtQjQIZfwdoREDACTEDozrmKYSWlCXsJ
 - The `client_secret`: 53e679ea-oRED-ACTED-92b8-3012c49c6cfa
 - A `sid`: qlBCREDACTEDEtgxD
@@ -412,7 +412,7 @@ Some homeservers may require the user to enter MSISDN.
 
 On matrix.org, it's not required, and not even optional, but it's still possible for the app to add a MSISDN during the registration.
 
-The user enter a phone number and select a country, the `client_secret` is generated by the application
+The user enters a phone number and selects a country, the `client_secret` is generated by the application
 
 ```shell script
 curl -X POST --data $'{"client_secret":"d3e285f6-972a-496c-9a22-7915a2db57c7","send_attempt":1,"country":"FR","phone_number":"+33611223344"}'  'https://matrix.org/_matrix/client/r0/register/msisdn/requestToken'
@@ -448,7 +448,7 @@ If it is not the case, the homeserver send the SMS and returns some data, especi
 }
 ```
 
-When you execute the register request, with the received `sid`, you get an error since the MSISDN is not validated yet:
+When we execute the register request, with the received `sid`, we get an error since the MSISDN is not validated yet:
 
 ```shell script
 curl -X POST --data $'{"auth":{"type":"m.login.msisdn","session":"xptUYoREDACTEDogOWAGVnbJQ","threepid_creds":{"client_secret":"d3e285f6-972a-496c-9a22-7915a2db57c7","sid":"1678881798"}}}' 'https://matrix.org/_matrix/client/r0/register'
@@ -558,7 +558,7 @@ curl -X POST --data $'{"auth":{"type":"m.login.msisdn","session":"xptUYoREDACTED
 }
 ```
 
-Now the homeserver consider that the `m.login.msisdn` step is completed (401):
+Now the homeserver considers that the `m.login.msisdn` step is completed (401):
 
 ```json
 {