Feature: Add a show/hide privacy toggle to passwords and secrets in Auth options (#2750)

* mask support for SingleLineEditor

* add secret visibility toggle button

* move visibility toggle into SingleLineComponent

Co-authored-by: Liz MacLean <18120837+lizziemac@users.noreply.github.com>

* fix eye button focus state

* center enabled and secret toggle

* fix input field scales to 100% width

* Using a prvacy toggle for all sensitive auth details.

* Applied privacy toggle to Collection Auth settings.

---------

Co-authored-by: Max Bauer <krummbar@pm.me>
Co-authored-by: Liz MacLean <18120837+lizziemac@users.noreply.github.com>
This commit is contained in:
Natalie Carey 2024-08-05 07:21:01 +01:00 committed by GitHub
parent 741250068f
commit c5ec7eea34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 34 additions and 13 deletions

View File

@ -138,6 +138,7 @@ const AwsV4Auth = ({ collection }) => {
onSave={handleSave} onSave={handleSave}
onChange={(val) => handleSecretAccessKeyChange(val)} onChange={(val) => handleSecretAccessKeyChange(val)}
collection={collection} collection={collection}
isSecret={true}
/> />
</div> </div>

View File

@ -62,6 +62,7 @@ const BasicAuth = ({ collection }) => {
onSave={handleSave} onSave={handleSave}
onChange={(val) => handlePasswordChange(val)} onChange={(val) => handlePasswordChange(val)}
collection={collection} collection={collection}
isSecret={true}
/> />
</div> </div>
</StyledWrapper> </StyledWrapper>

View File

@ -37,6 +37,7 @@ const BearerAuth = ({ collection }) => {
onSave={handleSave} onSave={handleSave}
onChange={(val) => handleTokenChange(val)} onChange={(val) => handleTokenChange(val)}
collection={collection} collection={collection}
isSecret={true}
/> />
</div> </div>
</StyledWrapper> </StyledWrapper>

View File

@ -62,6 +62,7 @@ const DigestAuth = ({ collection }) => {
onSave={handleSave} onSave={handleSave}
onChange={(val) => handlePasswordChange(val)} onChange={(val) => handlePasswordChange(val)}
collection={collection} collection={collection}
isSecret={true}
/> />
</div> </div>
</StyledWrapper> </StyledWrapper>

View File

@ -78,7 +78,7 @@ const OAuth2AuthorizationCode = ({ collection }) => {
return ( return (
<StyledWrapper className="mt-2 flex w-full gap-4 flex-col"> <StyledWrapper className="mt-2 flex w-full gap-4 flex-col">
{inputsConfig.map((input) => { {inputsConfig.map((input) => {
const { key, label } = input; const { key, label, isSecret } = input;
return ( return (
<div className="flex flex-col w-full gap-1" key={`input-${key}`}> <div className="flex flex-col w-full gap-1" key={`input-${key}`}>
<label className="block font-medium">{label}</label> <label className="block font-medium">{label}</label>
@ -90,6 +90,7 @@ const OAuth2AuthorizationCode = ({ collection }) => {
onChange={(val) => handleChange(key, val)} onChange={(val) => handleChange(key, val)}
onRun={handleRun} onRun={handleRun}
collection={collection} collection={collection}
isSecret={isSecret}
/> />
</div> </div>
</div> </div>

View File

@ -17,7 +17,8 @@ const inputsConfig = [
}, },
{ {
key: 'clientSecret', key: 'clientSecret',
label: 'Client Secret' label: 'Client Secret',
isSecret: true
}, },
{ {
key: 'scope', key: 'scope',

View File

@ -42,7 +42,7 @@ const OAuth2ClientCredentials = ({ collection }) => {
return ( return (
<StyledWrapper className="mt-2 flex w-full gap-4 flex-col"> <StyledWrapper className="mt-2 flex w-full gap-4 flex-col">
{inputsConfig.map((input) => { {inputsConfig.map((input) => {
const { key, label } = input; const { key, label, isSecret } = input;
return ( return (
<div className="flex flex-col w-full gap-1" key={`input-${key}`}> <div className="flex flex-col w-full gap-1" key={`input-${key}`}>
<label className="block font-medium">{label}</label> <label className="block font-medium">{label}</label>
@ -54,6 +54,7 @@ const OAuth2ClientCredentials = ({ collection }) => {
onChange={(val) => handleChange(key, val)} onChange={(val) => handleChange(key, val)}
onRun={handleRun} onRun={handleRun}
collection={collection} collection={collection}
isSecret={isSecret}
/> />
</div> </div>
</div> </div>

View File

@ -9,7 +9,8 @@ const inputsConfig = [
}, },
{ {
key: 'clientSecret', key: 'clientSecret',
label: 'Client Secret' label: 'Client Secret',
isSecret: true
}, },
{ {
key: 'scope', key: 'scope',

View File

@ -44,7 +44,7 @@ const OAuth2AuthorizationCode = ({ item, collection }) => {
return ( return (
<StyledWrapper className="mt-2 flex w-full gap-4 flex-col"> <StyledWrapper className="mt-2 flex w-full gap-4 flex-col">
{inputsConfig.map((input) => { {inputsConfig.map((input) => {
const { key, label } = input; const { key, label, isSecret } = input;
return ( return (
<div className="flex flex-col w-full gap-1" key={`input-${key}`}> <div className="flex flex-col w-full gap-1" key={`input-${key}`}>
<label className="block font-medium">{label}</label> <label className="block font-medium">{label}</label>
@ -56,6 +56,7 @@ const OAuth2AuthorizationCode = ({ item, collection }) => {
onChange={(val) => handleChange(key, val)} onChange={(val) => handleChange(key, val)}
onRun={handleRun} onRun={handleRun}
collection={collection} collection={collection}
isSecret={isSecret}
/> />
</div> </div>
</div> </div>

View File

@ -17,7 +17,8 @@ const inputsConfig = [
}, },
{ {
key: 'clientSecret', key: 'clientSecret',
label: 'Client Secret' label: 'Client Secret',
isSecret: true
}, },
{ {
key: 'scope', key: 'scope',

View File

@ -150,6 +150,7 @@ const AwsV4Auth = ({ onTokenChange, item, collection }) => {
onRun={handleRun} onRun={handleRun}
collection={collection} collection={collection}
item={item} item={item}
isSecret={true}
/> />
</div> </div>

View File

@ -69,6 +69,7 @@ const BasicAuth = ({ item, collection }) => {
onRun={handleRun} onRun={handleRun}
collection={collection} collection={collection}
item={item} item={item}
isSecret={true}
/> />
</div> </div>
</StyledWrapper> </StyledWrapper>

View File

@ -43,6 +43,7 @@ const BearerAuth = ({ item, collection }) => {
onRun={handleRun} onRun={handleRun}
collection={collection} collection={collection}
item={item} item={item}
isSecret={true}
/> />
</div> </div>
</StyledWrapper> </StyledWrapper>

View File

@ -69,6 +69,7 @@ const DigestAuth = ({ item, collection }) => {
onRun={handleRun} onRun={handleRun}
collection={collection} collection={collection}
item={item} item={item}
isSecret={true}
/> />
</div> </div>
</StyledWrapper> </StyledWrapper>

View File

@ -80,7 +80,7 @@ const OAuth2AuthorizationCode = ({ item, collection }) => {
return ( return (
<StyledWrapper className="mt-2 flex w-full gap-4 flex-col"> <StyledWrapper className="mt-2 flex w-full gap-4 flex-col">
{inputsConfig.map((input) => { {inputsConfig.map((input) => {
const { key, label } = input; const { key, label, isSecret } = input;
return ( return (
<div className="flex flex-col w-full gap-1" key={`input-${key}`}> <div className="flex flex-col w-full gap-1" key={`input-${key}`}>
<label className="block font-medium">{label}</label> <label className="block font-medium">{label}</label>
@ -93,6 +93,7 @@ const OAuth2AuthorizationCode = ({ item, collection }) => {
onRun={handleRun} onRun={handleRun}
collection={collection} collection={collection}
item={item} item={item}
isSecret={isSecret}
/> />
</div> </div>
</div> </div>

View File

@ -17,7 +17,8 @@ const inputsConfig = [
}, },
{ {
key: 'clientSecret', key: 'clientSecret',
label: 'Client Secret' label: 'Client Secret',
isSecret: true
}, },
{ {
key: 'scope', key: 'scope',

View File

@ -43,7 +43,7 @@ const OAuth2ClientCredentials = ({ item, collection }) => {
return ( return (
<StyledWrapper className="mt-2 flex w-full gap-4 flex-col"> <StyledWrapper className="mt-2 flex w-full gap-4 flex-col">
{inputsConfig.map((input) => { {inputsConfig.map((input) => {
const { key, label } = input; const { key, label, isSecret } = input;
return ( return (
<div className="flex flex-col w-full gap-1" key={`input-${key}`}> <div className="flex flex-col w-full gap-1" key={`input-${key}`}>
<label className="block font-medium">{label}</label> <label className="block font-medium">{label}</label>
@ -56,6 +56,7 @@ const OAuth2ClientCredentials = ({ item, collection }) => {
onRun={handleRun} onRun={handleRun}
collection={collection} collection={collection}
item={item} item={item}
isSecret={isSecret}
/> />
</div> </div>
</div> </div>

View File

@ -9,7 +9,8 @@ const inputsConfig = [
}, },
{ {
key: 'clientSecret', key: 'clientSecret',
label: 'Client Secret' label: 'Client Secret',
isSecret: true
}, },
{ {
key: 'scope', key: 'scope',

View File

@ -45,7 +45,7 @@ const OAuth2AuthorizationCode = ({ item, collection }) => {
return ( return (
<StyledWrapper className="mt-2 flex w-full gap-4 flex-col"> <StyledWrapper className="mt-2 flex w-full gap-4 flex-col">
{inputsConfig.map((input) => { {inputsConfig.map((input) => {
const { key, label } = input; const { key, label, isSecret } = input;
return ( return (
<div className="flex flex-col w-full gap-1" key={`input-${key}`}> <div className="flex flex-col w-full gap-1" key={`input-${key}`}>
<label className="block font-medium">{label}</label> <label className="block font-medium">{label}</label>
@ -58,6 +58,7 @@ const OAuth2AuthorizationCode = ({ item, collection }) => {
onRun={handleRun} onRun={handleRun}
collection={collection} collection={collection}
item={item} item={item}
isSecret={isSecret}
/> />
</div> </div>
</div> </div>

View File

@ -9,7 +9,8 @@ const inputsConfig = [
}, },
{ {
key: 'password', key: 'password',
label: 'Password' label: 'Password',
isSecret: true
}, },
{ {
key: 'clientId', key: 'clientId',
@ -17,7 +18,8 @@ const inputsConfig = [
}, },
{ {
key: 'clientSecret', key: 'clientSecret',
label: 'Client Secret' label: 'Client Secret',
isSecret: true
}, },
{ {
key: 'scope', key: 'scope',