📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
hide 'new password' field behind a spoiler
Blue Mouse6e77d6fc253c
diff --git a/public/locales/en.json b/public/locales/en.jsonindex 9acdfd440..b2d0333e9 100644--- a/public/locales/en.json+++ b/public/locales/en.json@@ -297,6 +297,7 @@"password": "Password","noRemember": "Don't remember me.","repeat": "Repeat password",+ "changePassword": "Change password","hint": "Longer than {{amount}} chars","xCharsError": "The password has to consist of at least {{amount}} characters.","noMatchError": "Passwords have to match.",diff --git a/src/pages/UserSettings/UserSettings.tsx b/src/pages/UserSettings/UserSettings.tsxindex d27594a56..4c4933060 100644--- a/src/pages/UserSettings/UserSettings.tsx+++ b/src/pages/UserSettings/UserSettings.tsx@@ -11,11 +11,12 @@ import _findIndex from 'lodash/findIndex'import _map from 'lodash/map'import _keys from 'lodash/keys'import {- EnvelopeIcon, ExclamationTriangleIcon, ArrowDownTrayIcon, CurrencyDollarIcon, ClipboardDocumentIcon,+ EnvelopeIcon, ExclamationTriangleIcon, ArrowDownTrayIcon, CurrencyDollarIcon, ClipboardDocumentIcon, ChevronDownIcon,} from '@heroicons/react/24/outline'import PropTypes from 'prop-types'import dayjs from 'dayjs'import utc from 'dayjs/plugin/utc'+import cx from 'clsx'import {reportFrequencies, DEFAULT_TIMEZONE, WEEKLY_REPORT_FREQUENCY, CONFIRMATION_TIMEOUT,@@ -101,6 +102,7 @@ const UserSettings = ({repeat: '',timeFormat: user.timeFormat || TimeFormat['12-hour'],})+ const [showPasswordFields, setShowPasswordFields] = useState<boolean>(false)const [timezone, setTimezone] = useState<string>(user.timezone || DEFAULT_TIMEZONE)const [isPaidFeatureOpened, setIsPaidFeatureOpened] = useState<boolean>(false)const [timezoneChanged, setTimezoneChanged] = useState<boolean>(false)@@ -359,6 +361,10 @@ const UserSettings = ({}}+ const toggleShowPasswordFields = () => {+ setShowPasswordFields((prev) => !prev)+ }+return (<Title title={t('titles.profileSettings')}><div className='min-h-min-footer bg-gray-50 dark:bg-slate-900 flex flex-col py-6 px-4 sm:px-6 lg:px-8'>@@ -383,31 +389,44 @@ const UserSettings = ({/>{!isSelfhosted && (<>- <div className='grid grid-cols-1 gap-y-6 gap-x-4 sm:grid-cols-6 mt-4'>- <Input- name='password'- id='password'- type='password'- label={t('auth.common.password')}- hint={t('auth.common.hint', { amount: MIN_PASSWORD_CHARS })}- value={form.password}- placeholder={t('auth.common.password')}- className='sm:col-span-3'- onChange={handleInput}- error={beenSubmitted ? errors.password : null}+ <span+ onClick={toggleShowPasswordFields}+ className='flex items-center cursor-pointer max-w-max text-gray-900 dark:text-gray-50 hover:underline'+ >+ {t('auth.common.changePassword')}+ <ChevronDownIcon+ className={cx('w-4 h-4 ml-2', {+ 'rotate-180': showPasswordFields,+ })}/>- <Input- name='repeat'- id='repeat'- type='password'- label={t('auth.common.repeat')}- value={form.repeat}- placeholder={t('auth.common.repeat')}- className='sm:col-span-3'- onChange={handleInput}- error={beenSubmitted ? errors.repeat : null}- />- </div>+ </span>+ {showPasswordFields && (+ <div className='grid grid-cols-1 gap-y-6 gap-x-4 sm:grid-cols-6 mt-4'>+ <Input+ name='password'+ id='password'+ type='password'+ label={t('auth.common.password')}+ hint={t('auth.common.hint', { amount: MIN_PASSWORD_CHARS })}+ value={form.password}+ placeholder={t('auth.common.password')}+ className='sm:col-span-3'+ onChange={handleInput}+ error={beenSubmitted ? errors.password : null}+ />+ <Input+ name='repeat'+ id='repeat'+ type='password'+ label={t('auth.common.repeat')}+ value={form.repeat}+ placeholder={t('auth.common.repeat')}+ className='sm:col-span-3'+ onChange={handleInput}+ error={beenSubmitted ? errors.repeat : null}+ />+ </div>+ )}<Button className='mt-4' type='submit' primary large>{t('profileSettings.update')}</Button>