diff --git a/services/web/app/src/Features/User/UserController.js b/services/web/app/src/Features/User/UserController.js
index 5ed1e022c6..5af414189f 100644
--- a/services/web/app/src/Features/User/UserController.js
+++ b/services/web/app/src/Features/User/UserController.js
@@ -73,7 +73,11 @@ async function changePassword(req, res, next) {
req.body.currentPassword
)
if (!user) {
- return HttpErrorHandler.badRequest(req, res, 'Your old password is wrong')
+ return HttpErrorHandler.badRequest(
+ req,
+ res,
+ req.i18n.translate('password_change_old_password_wrong')
+ )
}
if (req.body.newPassword1 !== req.body.newPassword2) {
diff --git a/services/web/app/src/Features/User/UserPagesController.js b/services/web/app/src/Features/User/UserPagesController.js
index 899d91287a..4f9433da9a 100644
--- a/services/web/app/src/Features/User/UserPagesController.js
+++ b/services/web/app/src/Features/User/UserPagesController.js
@@ -82,8 +82,6 @@ async function settingsPage(req, res) {
},
},
hasPassword: !!user.hashedPassword,
- firstName: user.first_name,
- lastName: user.last_name,
shouldAllowEditingDetails,
oauthProviders: UserPagesController._translateProviderDescriptions(
oauthProviders,
diff --git a/services/web/app/views/user/settings-react.pug b/services/web/app/views/user/settings-react.pug
index 9270a7ee7d..2775dfb50c 100644
--- a/services/web/app/views/user/settings-react.pug
+++ b/services/web/app/views/user/settings-react.pug
@@ -1,4 +1,4 @@
-extends ../layout
+extends ../layout-marketing
block entrypointVar
- entrypoint = 'pages/user/settings'
@@ -18,8 +18,6 @@ block append meta
meta(name="ol-thirdPartyIds", data-type="json", content=thirdPartyIds || {})
meta(name="ol-passwordStrengthOptions", data-type="json", content=settings.passwordStrengthOptions || {})
meta(name="ol-isExternalAuthenticationSystemUsed" data-type="boolean" content=externalAuthenticationSystemUsed())
- meta(name="ol-firstName" content=firstName)
- meta(name="ol-lastName" content=lastName)
meta(name="ol-user" data-type="json" content=user)
meta(name="ol-dropbox" data-type="json" content=dropbox)
meta(name="ol-github" data-type="json" content=github)
diff --git a/services/web/frontend/js/features/settings/components/account-info-section.tsx b/services/web/frontend/js/features/settings/components/account-info-section.tsx
index ab5113eb92..b158e8d5f8 100644
--- a/services/web/frontend/js/features/settings/components/account-info-section.tsx
+++ b/services/web/frontend/js/features/settings/components/account-info-section.tsx
@@ -11,6 +11,7 @@ import { postJSON } from '../../../infrastructure/fetch-json'
import getMeta from '../../../utils/meta'
import { ExposedSettings } from '../../../../../types/exposed-settings'
import useAsync from '../../../shared/hooks/use-async'
+import { useUserContext } from '../../../shared/context/user-context'
function AccountInfoSection() {
const { t } = useTranslation()
@@ -23,15 +24,16 @@ function AccountInfoSection() {
const shouldAllowEditingDetails = getMeta(
'ol-shouldAllowEditingDetails'
) as boolean
+ const {
+ first_name: initialFirstName,
+ last_name: initialLastName,
+ email: initialEmail,
+ } = useUserContext()
- const [email, setEmail] = useState(() => getMeta('ol-usersEmail') as string)
- const [firstName, setFirstName] = useState(
- () => getMeta('ol-firstName') as string
- )
- const [lastName, setLastName] = useState(
- () => getMeta('ol-lastName') as string
- )
- const { isLoading, error, isSuccess, runAsync } = useAsync()
+ const [email, setEmail] = useState(initialEmail)
+ const [firstName, setFirstName] = useState(initialFirstName)
+ const [lastName, setLastName] = useState(initialLastName)
+ const { isLoading, isSuccess, isError, error, runAsync } = useAsync()
const [isFormValid, setIsFormValid] = useState(true)
const handleEmailChange = event => {
@@ -60,8 +62,8 @@ function AccountInfoSection() {
postJSON('/user/settings', {
body: {
email: canUpdateEmail ? email : undefined,
- firstName: canUpdateNames ? firstName : undefined,
- lastName: canUpdateNames ? lastName : undefined,
+ first_name: canUpdateNames ? firstName : undefined,
+ last_name: canUpdateNames ? lastName : undefined,
},
})
).catch(() => {})
@@ -105,7 +107,7 @@ function AccountInfoSection() {
{t('thanks_settings_updated')}
) : null}
- {error ? (
+ {isError ? (
{error.getUserFacingMessage()}
diff --git a/services/web/frontend/js/features/settings/components/leave-section.tsx b/services/web/frontend/js/features/settings/components/leave-section.tsx
index ceaf270b58..99e5c538bb 100644
--- a/services/web/frontend/js/features/settings/components/leave-section.tsx
+++ b/services/web/frontend/js/features/settings/components/leave-section.tsx
@@ -18,7 +18,7 @@ function LeaveSection() {
return (
<>
{t('need_to_leave')}{' '}
-