fix(ui): correctly set autocomplete attribute for password fields (#1430)

This commit is contained in:
TheCatLady
2021-04-15 23:45:50 -04:00
committed by GitHub
parent a6bfb5e74e
commit 4b5e355df9
5 changed files with 27 additions and 16 deletions

View File

@@ -84,6 +84,7 @@ const LocalLogin: React.FC<LocalLoginProps> = ({ revalidate }) => {
id="password" id="password"
name="password" name="password"
type="password" type="password"
autoComplete="current-password"
placeholder={intl.formatMessage(messages.password)} placeholder={intl.formatMessage(messages.password)}
/> />
</div> </div>

View File

@@ -1,13 +1,13 @@
import React, { useState } from 'react';
import ImageFader from '../Common/ImageFader';
import { defineMessages, useIntl } from 'react-intl';
import LanguagePicker from '../Layout/LanguagePicker';
import Button from '../Common/Button';
import { Field, Form, Formik } from 'formik';
import * as Yup from 'yup';
import axios from 'axios'; import axios from 'axios';
import { useRouter } from 'next/router'; import { Field, Form, Formik } from 'formik';
import Link from 'next/link'; import Link from 'next/link';
import { useRouter } from 'next/router';
import React, { useState } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import * as Yup from 'yup';
import Button from '../Common/Button';
import ImageFader from '../Common/ImageFader';
import LanguagePicker from '../Layout/LanguagePicker';
const messages = defineMessages({ const messages = defineMessages({
passwordreset: 'Password Reset', passwordreset: 'Password Reset',
@@ -120,9 +120,7 @@ const ResetPassword: React.FC = () => {
id="password" id="password"
name="password" name="password"
type="password" type="password"
placeholder={intl.formatMessage( autoComplete="new-password"
messages.password
)}
className="flex-1 block w-full min-w-0 text-white transition duration-150 ease-in-out bg-gray-700 border border-gray-500 rounded-md form-input sm:text-sm sm:leading-5" className="flex-1 block w-full min-w-0 text-white transition duration-150 ease-in-out bg-gray-700 border border-gray-500 rounded-md form-input sm:text-sm sm:leading-5"
/> />
</div> </div>
@@ -141,8 +139,8 @@ const ResetPassword: React.FC = () => {
<Field <Field
id="confirmPassword" id="confirmPassword"
name="confirmPassword" name="confirmPassword"
placeholder="Confirm Password"
type="password" type="password"
autoComplete="new-password"
className="flex-1 block w-full min-w-0 text-white transition duration-150 ease-in-out bg-gray-700 border border-gray-500 rounded-md form-input sm:text-sm sm:leading-5" className="flex-1 block w-full min-w-0 text-white transition duration-150 ease-in-out bg-gray-700 border border-gray-500 rounded-md form-input sm:text-sm sm:leading-5"
/> />
</div> </div>

View File

@@ -62,6 +62,7 @@ const messages = defineMessages({
passwordinfodescription: passwordinfodescription:
'Enable email notifications to allow automatic password generation.', 'Enable email notifications to allow automatic password generation.',
autogeneratepassword: 'Automatically Generate Password', autogeneratepassword: 'Automatically Generate Password',
autogeneratepasswordTip: 'Email a server-generated password to the user',
validationEmail: 'You must provide a valid email address', validationEmail: 'You must provide a valid email address',
sortCreated: 'Creation Date', sortCreated: 'Creation Date',
sortUpdated: 'Last Updated', sortUpdated: 'Last Updated',
@@ -377,6 +378,9 @@ const UserList: React.FC = () => {
> >
<label htmlFor="genpassword" className="checkbox-label"> <label htmlFor="genpassword" className="checkbox-label">
{intl.formatMessage(messages.autogeneratepassword)} {intl.formatMessage(messages.autogeneratepassword)}
<span className="label-tip">
{intl.formatMessage(messages.autogeneratepasswordTip)}
</span>
</label> </label>
<div className="form-input"> <div className="form-input">
<Field <Field
@@ -402,8 +406,8 @@ const UserList: React.FC = () => {
id="password" id="password"
name="password" name="password"
type="password" type="password"
autoComplete="new-password"
disabled={values.genpassword} disabled={values.genpassword}
placeholder={intl.formatMessage(messages.password)}
/> />
</div> </div>
{errors.password && touched.password && ( {errors.password && touched.password && (

View File

@@ -165,7 +165,8 @@ const UserPasswordChange: React.FC = () => {
<Field <Field
id="currentPassword" id="currentPassword"
name="currentPassword" name="currentPassword"
type="text" type="password"
autoComplete="current-password"
/> />
</div> </div>
{errors.currentPassword && touched.currentPassword && ( {errors.currentPassword && touched.currentPassword && (
@@ -180,7 +181,12 @@ const UserPasswordChange: React.FC = () => {
</label> </label>
<div className="form-input"> <div className="form-input">
<div className="form-input-field"> <div className="form-input-field">
<Field id="newPassword" name="newPassword" type="text" /> <Field
id="newPassword"
name="newPassword"
type="password"
autoComplete="new-password"
/>
</div> </div>
{errors.newPassword && touched.newPassword && ( {errors.newPassword && touched.newPassword && (
<div className="error">{errors.newPassword}</div> <div className="error">{errors.newPassword}</div>
@@ -196,7 +202,8 @@ const UserPasswordChange: React.FC = () => {
<Field <Field
id="confirmPassword" id="confirmPassword"
name="confirmPassword" name="confirmPassword"
type="text" type="password"
autoComplete="new-password"
/> />
</div> </div>
{errors.confirmPassword && touched.confirmPassword && ( {errors.confirmPassword && touched.confirmPassword && (

View File

@@ -646,6 +646,7 @@
"components.UserList.accounttype": "Account Type", "components.UserList.accounttype": "Account Type",
"components.UserList.admin": "Admin", "components.UserList.admin": "Admin",
"components.UserList.autogeneratepassword": "Automatically Generate Password", "components.UserList.autogeneratepassword": "Automatically Generate Password",
"components.UserList.autogeneratepasswordTip": "Email a server-generated password to the user",
"components.UserList.bulkedit": "Bulk Edit", "components.UserList.bulkedit": "Bulk Edit",
"components.UserList.create": "Create", "components.UserList.create": "Create",
"components.UserList.created": "Created", "components.UserList.created": "Created",