-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18576 from thiagobrez/two-factor-auth
feat: add 2-factor authentication
- Loading branch information
Showing
29 changed files
with
1,071 additions
and
28 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,63 @@ | ||
import React from 'react'; | ||
import QRCodeLibrary from 'react-native-qrcode-svg'; | ||
import PropTypes from 'prop-types'; | ||
import defaultTheme from '../../styles/themes/default'; | ||
|
||
const propTypes = { | ||
/** | ||
* The QR code URL | ||
*/ | ||
url: PropTypes.string.isRequired, | ||
/** | ||
* The logo which will be displayed in the middle of the QR code. | ||
* Follows `ImageSourcePropType` from react-native. | ||
*/ | ||
logo: PropTypes.oneOfType([PropTypes.shape({uri: PropTypes.string}), PropTypes.number]), | ||
/** | ||
* The QRCode size | ||
*/ | ||
size: PropTypes.number, | ||
/** | ||
* The QRCode color | ||
*/ | ||
color: PropTypes.string, | ||
/** | ||
* The QRCode background color | ||
*/ | ||
backgroundColor: PropTypes.string, | ||
/** | ||
* Function to retrieve the internal component ref and be able to call it's | ||
* methods | ||
*/ | ||
getRef: PropTypes.func, | ||
}; | ||
|
||
const defaultProps = { | ||
logo: undefined, | ||
size: 120, | ||
color: defaultTheme.text, | ||
backgroundColor: defaultTheme.highlightBG, | ||
getRef: undefined, | ||
}; | ||
|
||
function QRCode(props) { | ||
return ( | ||
<QRCodeLibrary | ||
getRef={props.getRef} | ||
value={props.url} | ||
size={props.size} | ||
logo={props.logo} | ||
logoBackgroundColor="transparent" | ||
logoSize={props.size * 0.3} | ||
logoBorderRadius={props.size} | ||
backgroundColor={props.backgroundColor} | ||
color={props.color} | ||
/> | ||
); | ||
} | ||
|
||
QRCode.displayName = 'QRCode'; | ||
QRCode.propTypes = propTypes; | ||
QRCode.defaultProps = defaultProps; | ||
|
||
export default QRCode; |
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
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
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
Oops, something went wrong.