Skip to content

📈 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!

added 'check if password is leaked' feature

Blue Mouse8a068f540c95
diff --git a/public/locales/en.json b/public/locales/en.json
index 2ee5d36a0..7771bea70 100644
--- a/public/locales/en.json
+++ b/public/locales/en.json
@@ -1,4 +1,7 @@
{
+ "apiNotifications": {
+ "leakedPassword": "The provided password is leaked, please use another one"
+ },
"common": {
"features": "Features",
"docs": "Docs",
@@ -123,7 +126,9 @@
"badEmailError": "Please provide a valid email.",
"tosError": "You have to accept our TOS and privacy policy in order to use our services.",
"email": "Email",
- "signin": "Sign in"
+ "signin": "Sign in",
+ "checkLeakedPassword": "Check if password is leaked",
+ "checkLeakedPasswordDesc": "When enabled we check your password with the <db>{{database}}</db> database. We don't send your password to the service. First we hash your password (using SHA1) and send only the first 5 characters of that hash to the service. The service returns all leaked passwords that start with those 5 characters. At our end we check if one of these matches with your password. We show you a warning if it has been leaked before. We never store your password in plain text."
}
},
"features": {
diff --git a/src/pages/Auth/Signup/Signup.jsx b/src/pages/Auth/Signup/Signup.jsx
index 729043beb..daecb2520 100644
--- a/src/pages/Auth/Signup/Signup.jsx
+++ b/src/pages/Auth/Signup/Signup.jsx
@@ -9,10 +9,13 @@ import routes from 'routes'
import Input from 'ui/Input'
import Checkbox from 'ui/Checkbox'
import Button from 'ui/Button'
+import Tooltip from 'ui/Tooltip'
import {
isValidEmail, isValidPassword, MIN_PASSWORD_CHARS,
} from 'utils/validator'
+const HAVE_I_BEEN_PWNED_URL = 'https://haveibeenpwned.com/passwords'
+
const Signup = ({ signup }) => {
const { t } = useTranslation('common')
const [form, setForm] = useState({
@@ -20,7 +23,8 @@ const Signup = ({ signup }) => {
password: '',
repeat: '',
tos: false,
- keep_signedin: false
+ keep_signedin: false,
+ checkIfLeaked: true,
})
const [validated, setValidated] = useState(false)
const [errors, setErrors] = useState({})
@@ -146,6 +150,31 @@ const Signup = ({ signup }) => {
}
hint={beenSubmitted ? errors.tos : ''}
/>
+ <div className='flex mt-4'>
+ <Checkbox
+ checked={form.checkIfLeaked}
+ onChange={handleInput}
+ name='checkIfLeaked'
+ id='checkIfLeaked'
+ label={t('auth.common.checkLeakedPassword')}
+ />
+ <Tooltip
+ className='ml-2'
+ text={(
+ <Trans
+ t={t}
+ i18nKey='auth.common.checkLeakedPasswordDesc'
+ components={{
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
+ db: <a href={HAVE_I_BEEN_PWNED_URL} className='font-medium text-indigo-400 hover:underline hover:text-indigo-500 dark:text-indigo-400 dark:hover:text-indigo-500' />,
+ }}
+ values={{
+ database: 'haveibeenpwned.com',
+ }}
+ />
+ )}
+ />
+ </div>
<Checkbox
checked={form.keep_signedin}
onChange={handleInput}