-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
488 additions
and
11 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
packages/bruno-app/src/components/CollectionSettings/Auth/NTLMAuth/StyledWrapper.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import styled from 'styled-components'; | ||
|
||
const Wrapper = styled.div` | ||
label { | ||
font-size: 0.8125rem; | ||
} | ||
.single-line-editor-wrapper { | ||
max-width: 400px; | ||
padding: 0.15rem 0.4rem; | ||
border-radius: 3px; | ||
border: solid 1px ${(props) => props.theme.input.border}; | ||
background-color: ${(props) => props.theme.input.bg}; | ||
} | ||
`; | ||
|
||
export default Wrapper; |
110 changes: 110 additions & 0 deletions
110
packages/bruno-app/src/components/CollectionSettings/Auth/NTLMAuth/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import React from 'react'; | ||
import get from 'lodash/get'; | ||
import { useTheme } from 'providers/Theme'; | ||
import { useDispatch } from 'react-redux'; | ||
import SingleLineEditor from 'components/SingleLineEditor'; | ||
import { updateCollectionAuth } from 'providers/ReduxStore/slices/collections'; | ||
import { saveCollectionRoot } from 'providers/ReduxStore/slices/collections/actions'; | ||
import StyledWrapper from './StyledWrapper'; | ||
|
||
|
||
|
||
|
||
|
||
const NTLMAuth = ({ collection }) => { | ||
|
||
|
||
const dispatch = useDispatch(); | ||
const { storedTheme } = useTheme(); | ||
|
||
const ntlmAuth = get(collection, 'root.request.auth.ntlm', {}); | ||
|
||
const handleSave = () => dispatch(saveCollectionRoot(collection.uid)); | ||
|
||
|
||
const handleUsernameChange = (username) => { | ||
dispatch( | ||
updateCollectionAuth({ | ||
mode: 'ntlm', | ||
collectionUid: collection.uid, | ||
content: { | ||
username: username, | ||
password: ntlmAuth.password, | ||
domain: ntlmAuth.domain | ||
|
||
} | ||
}) | ||
); | ||
}; | ||
|
||
const handlePasswordChange = (password) => { | ||
dispatch( | ||
updateCollectionAuth({ | ||
mode: 'ntlm', | ||
collectionUid: collection.uid, | ||
content: { | ||
username: ntlmAuth.username, | ||
password: password, | ||
domain: ntlmAuth.domain | ||
} | ||
}) | ||
); | ||
}; | ||
|
||
const handleDomainChange = (domain) => { | ||
dispatch( | ||
updateCollectionAuth({ | ||
mode: 'ntlm', | ||
collectionUid: collection.uid, | ||
content: { | ||
username: ntlmAuth.username, | ||
password: ntlmAuth.password, | ||
domain: domain | ||
} | ||
}) | ||
); | ||
}; | ||
|
||
|
||
|
||
|
||
return ( | ||
<StyledWrapper className="mt-2 w-full"> | ||
<label className="block font-medium mb-2">Username</label> | ||
<div className="single-line-editor-wrapper mb-2"> | ||
<SingleLineEditor | ||
value={ntlmAuth.username || ''} | ||
theme={storedTheme} | ||
onSave={handleSave} | ||
onChange={(val) => handleUsernameChange(val)} | ||
collection={collection} | ||
/> | ||
</div> | ||
|
||
<label className="block font-medium mb-2">Password</label> | ||
<div className="single-line-editor-wrapper"> | ||
<SingleLineEditor | ||
value={ntlmAuth.password || ''} | ||
theme={storedTheme} | ||
onSave={handleSave} | ||
onChange={(val) => handlePasswordChange(val)} | ||
collection={collection} | ||
isSecret={true} | ||
/> | ||
</div> | ||
|
||
<label className="block font-medium mb-2">Domain</label> | ||
<div className="single-line-editor-wrapper"> | ||
<SingleLineEditor | ||
value={ntlmAuth.domain || ''} | ||
theme={storedTheme} | ||
onSave={handleSave} | ||
onChange={(val) => handleDomainChange(val)} | ||
collection={collection} | ||
/> | ||
</div> | ||
</StyledWrapper> | ||
); | ||
}; | ||
|
||
export default NTLMAuth; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
packages/bruno-app/src/components/RequestPane/Auth/NTLMAuth/StyledWrapper.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import styled from 'styled-components'; | ||
|
||
const Wrapper = styled.div` | ||
label { | ||
font-size: 0.8125rem; | ||
} | ||
.single-line-editor-wrapper { | ||
max-width: 400px; | ||
padding: 0.15rem 0.4rem; | ||
border-radius: 3px; | ||
border: solid 1px ${(props) => props.theme.input.border}; | ||
background-color: ${(props) => props.theme.input.bg}; | ||
} | ||
`; | ||
|
||
export default Wrapper; |
Oops, something went wrong.