Skip to content

Commit

Permalink
Indicate that we support either username or email
Browse files Browse the repository at this point in the history
Param `username` of `actions/authenticate-user` and
`actions/user/recover-password` is renamed to `username_or_email`.

The UI pages (signing and forgot-password) also say "Username or email
address" for the form field.
  • Loading branch information
siddhantk232 authored and amitu committed Sep 4, 2024
1 parent 760991d commit 8363611
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
6 changes: 3 additions & 3 deletions actions/authenticate-user.ftd
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
-- ftd.string-field $username: username
-- ftd.string-field $username-or-email: username-or-email
-- ftd.string-field $password: password
-- ftd.string-field $next: next
value: /

-- void submit-values(username, password, next):
ftd.string-field $username:
-- void submit-values(username_or_email, password, next):
ftd.string-field $username_or_email:
ftd.string-field $password:
ftd.string-field $next:
js: $assets.files.assets.functions.js
Expand Down
6 changes: 3 additions & 3 deletions actions/user/recover-password.ftd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- ftd.string-field $username: username
-- ftd.string-field $username-or-email: username-or-email

-- ftd.string-field $next: next
value: /forgot-password-success/
Expand All @@ -8,8 +8,8 @@ value: /forgot-password-success/
value: /set-password/


-- void submit-values(username):
string username:
-- void submit-values(username_or_email):
ftd.string-field username_or_email:
ftd.string-field next: $next
ftd.string-field set_password_route: $set-password-route
js: $assets.files.assets.functions.js
Expand Down
32 changes: 16 additions & 16 deletions pages/forgot-password.ftd
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,31 @@ module action: recover-password
spacing: $ds.spaces.vertical-gap.extra-extra-small
align-content: left

-- ds.copy-small: Username
-- ds.copy-small: Username or email address

-- ftd.text-input:
placeholder: Enter username or email
placeholder: Enter username or email address
type: text
$on-input$: $ftd.set-string($a = $page.action.username.value, v = $VALUE)
$on-input$: $utils.set-null($var = $page.action.username.error)
$on-input$: $ftd.set-string($a = $page.action.username-or-email.value, v = $VALUE)
$on-input$: $utils.set-null($var = $page.action.username-or-email.error)
width: fill-container
height.fixed.px: 40
border-radius.px: 8
background.solid: transparent
border-width.px: 1
border-color: $inherited.colors.border
border-color if { page.action.username.error != NULL }: $inherited.colors.error.border
border-color if { page.action.username-or-email.error != NULL }: $inherited.colors.error.border
padding.px: 8
color: $inherited.colors.text-strong

-- ds.copy-small: $page.action.username.error
if: { page.action.username.error != NULL }
-- ds.copy-small: $page.action.username-or-email.error
if: { page.action.username-or-email.error != NULL }
color: $ds.colors.error.text

-- end: ds.column

-- ds.primary-button: Send Reset Link
$on-click$: $page.action.submit-values(username = $page.action.username)
$on-click$: $page.action.submit-values(username_or_email = $page.action.username-or-email)
width: full
radius: curved

Expand Down Expand Up @@ -122,31 +122,31 @@ module action: recover-password
spacing: $ds.spaces.vertical-gap.extra-extra-small
align-content: left

-- ds.copy-small: Username
-- ds.copy-small: Username or email address

-- ftd.text-input:
placeholder: Enter username or email
placeholder: Enter username or email address
type: text
$on-input$: $ftd.set-string($a = $page.action.username.value, v = $VALUE)
$on-input$: $utils.set-null($var = $page.action.username.error)
$on-input$: $ftd.set-string($a = $page.action.username-or-email.value, v = $VALUE)
$on-input$: $utils.set-null($var = $page.action.username-or-email.error)
width: fill-container
height.fixed.px: 40
border-radius.px: 8
background.solid: transparent
border-width.px: 1
border-color: $inherited.colors.border
border-color if { page.action.username.error != NULL }: $inherited.colors.error.border
border-color if { page.action.username-or-email.error != NULL }: $inherited.colors.error.border
padding.px: 8
color: $inherited.colors.text-strong

-- ds.copy-small: $page.action.username.error
if: { page.action.username.error != NULL }
-- ds.copy-small: $page.action.username-or-email.error
if: { page.action.username-or-email.error != NULL }
color: $ds.colors.error.text

-- end: ds.column

-- ds.primary-button: Send Reset Link
$on-click$: $page.action.submit-values(username = $page.action.username)
$on-click$: $page.action.submit-values(username_or_email = $page.action.username-or-email)
width: full
radius: curved

Expand Down
32 changes: 16 additions & 16 deletions pages/signin.ftd
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,25 @@ module authenticate-user: authenticate-user
spacing: $ds.spaces.vertical-gap.extra-extra-small
align-content: left

-- ds.copy-small: Username
-- ds.copy-small: Username or email address

-- ftd.text-input:
placeholder: Enter username
placeholder: Enter username or email address
type: text
$on-input$: $ftd.set-string($a = $page.authenticate-user.username.value, v = $VALUE)
$on-input$: $utils.set-null($var = $page.authenticate-user.username.error)
$on-input$: $ftd.set-string($a = $page.authenticate-user.username-or-email.value, v = $VALUE)
$on-input$: $utils.set-null($var = $page.authenticate-user.username-or-email.error)
width: fill-container
height.fixed.px: 40
border-radius.px: 8
background.solid: transparent
border-width.px: 1
border-color: $inherited.colors.border
border-color if { page.authenticate-user.username.error != NULL }: $inherited.colors.error.border
border-color if { page.authenticate-user.username-or-email.error != NULL }: $inherited.colors.error.border
padding.px: 8
color: $inherited.colors.text-strong

-- ds.copy-small: $page.authenticate-user.username.error
if: { page.authenticate-user.username.error != NULL }
-- ds.copy-small: $page.authenticate-user.username-or-email.error
if: { page.authenticate-user.username-or-email.error != NULL }
color: $ds.colors.error.text

-- end: ds.column
Expand Down Expand Up @@ -97,7 +97,7 @@ module authenticate-user: authenticate-user
-- end: ds.column

-- ds.primary-button: Login
$on-click$: $page.authenticate-user.submit-values($username=$page.authenticate-user.username, $password=$page.authenticate-user.password, $next=$page.authenticate-user.next)
$on-click$: $page.authenticate-user.submit-values($username_or_email=$page.authenticate-user.username-or-email, $password=$page.authenticate-user.password, $next=$page.authenticate-user.next)
width: full
radius: curved

Expand Down Expand Up @@ -162,25 +162,25 @@ module authenticate-user: authenticate-user
spacing: $ds.spaces.vertical-gap.extra-extra-small
align-content: left

-- ds.copy-small: Username
-- ds.copy-small: Username or email address

-- ftd.text-input:
placeholder: Enter username
placeholder: Enter username or email address
type: text
$on-input$: $ftd.set-string($a = $page.authenticate-user.username.value, v = $VALUE)
$on-input$: $utils.set-null($var = $page.authenticate-user.username.error)
$on-input$: $ftd.set-string($a = $page.authenticate-user.username-or-email.value, v = $VALUE)
$on-input$: $utils.set-null($var = $page.authenticate-user.username-or-email.error)
width: fill-container
height.fixed.px: 40
border-radius.px: 8
background.solid: transparent
border-width.px: 1
border-color: $inherited.colors.border
border-color if { page.authenticate-user.username.error != NULL }: $inherited.colors.error.border
border-color if { page.authenticate-user.username-or-email.error != NULL }: $inherited.colors.error.border
padding.px: 8
color: $inherited.colors.text-strong

-- ds.copy-small: $page.authenticate-user.username.error
if: { page.authenticate-user.username.error != NULL }
-- ds.copy-small: $page.authenticate-user.username-or-email.error
if: { page.authenticate-user.username-or-email.error != NULL }
color: $ds.colors.error.text

-- end: ds.column
Expand Down Expand Up @@ -213,7 +213,7 @@ module authenticate-user: authenticate-user
-- end: ds.column

-- ds.primary-button: Login
$on-click$: $page.authenticate-user.submit-values($username=$page.authenticate-user.username, $password=$page.authenticate-user.password, $next=$page.authenticate-user.next)
$on-click$: $page.authenticate-user.submit-values($username_or_email=$page.authenticate-user.username-or-email, $password=$page.authenticate-user.password, $next=$page.authenticate-user.next)
width: full
radius: curved

Expand Down

0 comments on commit 8363611

Please sign in to comment.