-
Notifications
You must be signed in to change notification settings - Fork 6
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 #15 from marmelab/feat/totp-support
Add support for TOTP MFA
- Loading branch information
Showing
30 changed files
with
5,249 additions
and
3,348 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -4,29 +4,29 @@ | |
"author": "Gildas Garcia <[email protected]> (https://marmelab.com/)", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@babel/preset-env": "^7.15.0", | ||
"@babel/preset-react": "^7.14.5", | ||
"@babel/preset-typescript": "^7.15.0", | ||
"@types/jest": "^29.1.0", | ||
"@typescript-eslint/eslint-plugin": "^4.28.5", | ||
"@typescript-eslint/parser": "^4.28.5", | ||
"babel-jest": "^27.1.0", | ||
"eslint": "^7.7.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-config-react-app": "^5.2.1", | ||
"eslint-plugin-cypress": "^2.11.1", | ||
"eslint-plugin-flowtype": "^5.2.0", | ||
"eslint-plugin-import": "^2.22.0", | ||
"eslint-plugin-jsx-a11y": "^6.3.1", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"eslint-plugin-react": "^7.20.6", | ||
"eslint-plugin-react-hooks": "^4.1.0", | ||
"jest": "^29.1.1", | ||
"jest-environment-jsdom": "^29.1.1", | ||
"prettier": "~2.1.1", | ||
"@babel/preset-env": "^7.23.9", | ||
"@babel/preset-react": "^7.23.3", | ||
"@babel/preset-typescript": "^7.23.3", | ||
"@types/jest": "^29.5.12", | ||
"@typescript-eslint/eslint-plugin": "^6.21.0", | ||
"@typescript-eslint/parser": "^6.21.0", | ||
"babel-jest": "^29.7.0", | ||
"eslint": "^8.56.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-config-react-app": "^7.0.1", | ||
"eslint-plugin-cypress": "^2.15.1", | ||
"eslint-plugin-flowtype": "^8.0.3", | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-jsx-a11y": "^6.8.0", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"eslint-plugin-react": "^7.33.2", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"jest": "^29.7.0", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"prettier": "^3.2.5", | ||
"raf": "^3.4.1", | ||
"ts-jest": "^29.0.3", | ||
"typescript": "^4.8.4" | ||
"ts-jest": "^29.1.2", | ||
"typescript": "^5.3.3" | ||
}, | ||
"scripts": { | ||
"build": "yarn workspaces run build", | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# ra-auth-cognito-language-english | ||
|
||
English translations for [ra-auth-cognito](https://www.npmjs.com/package/ra-auth-cognito). | ||
|
||
## Installation | ||
|
||
```sh | ||
npm install ra-auth-cognito-language-english | ||
# or | ||
yarn add ra-auth-cognito-language-english | ||
``` | ||
|
||
## Usage | ||
|
||
```js | ||
// in i18nProvider.js | ||
import { raAuthCognitoEnglishMessages } from 'ra-auth-cognito-language-english'; | ||
import { mergeTranslations } from 'react-admin'; | ||
import polyglotI18nProvider from 'ra-i18n-polyglot'; | ||
import englishMessages from 'ra-language-english'; | ||
|
||
const allEnglishMessages = mergeTranslations( | ||
englishMessages, | ||
raAuthCognitoEnglishMessages | ||
); | ||
|
||
export const i18nProvider = polyglotI18nProvider( | ||
locale => allEnglishMessages, | ||
'en' | ||
); | ||
|
||
// in App.js | ||
import { Admin, Resource, ListGuesser } from 'react-admin'; | ||
import { authRoutes } from 'ra-auth-cognito'; | ||
import { dataProvider } from './dataProvider'; | ||
import { authProvider } from './authProvider'; | ||
import { i18nProvider } from './i18nProvider'; | ||
|
||
export const MyAdmin = () => ( | ||
<Admin | ||
dataProvider={dataProvider} | ||
authProvider={authProvider} | ||
i18nProvider={i18nProvider} | ||
customRoutes={authRoutes} | ||
> | ||
<Resource name="posts" list={ListGuesser} /> | ||
<Resource name="authors" list={ListGuesser} /> | ||
</Admin> | ||
); | ||
``` |
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,58 @@ | ||
{ | ||
"name": "ra-auth-cognito-language-english", | ||
"version": "1.1.0", | ||
"repository": "[email protected]:marmelab/ra-auth-cognito.git", | ||
"author": "Guillaume Pierson <[email protected]> (https://marmelab.com/)", | ||
"license": "MIT", | ||
"files": [ | ||
"*.md", | ||
"lib", | ||
"esm", | ||
"src" | ||
], | ||
"main": "lib/index", | ||
"module": "esm/index.js", | ||
"types": "esm/index.d.ts", | ||
"sideEffects": false, | ||
"peerDependencies": { | ||
"ra-auth-cognito": "^1.1.0" | ||
}, | ||
"scripts": { | ||
"build": "yarn run build-cjs && yarn run build-esm", | ||
"build-cjs": "rimraf ./lib && tsc", | ||
"build-esm": "rimraf ./esm && tsc --outDir esm --module es2015", | ||
"watch": "tsc --outDir esm --module es2015 --watch", | ||
"lint": "eslint --fix ./src", | ||
"test-unit": "jest" | ||
}, | ||
"devDependencies": { | ||
"ra-auth-cognito": "workspace:^", | ||
"rimraf": "^5.0.5", | ||
"typescript": "^5.3.3" | ||
}, | ||
"jest": { | ||
"preset": "ts-jest", | ||
"testEnvironment": "jsdom", | ||
"collectCoverageFrom": [ | ||
"**/*.js", | ||
"**/*.ts", | ||
"!__tests__/util.ts", | ||
"!coverage/**", | ||
"!**/node_modules/**" | ||
], | ||
"verbose": true, | ||
"automock": false, | ||
"clearMocks": true, | ||
"testPathIgnorePatterns": [ | ||
"/node_modules/" | ||
], | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js", | ||
"jsx", | ||
"json", | ||
"node" | ||
] | ||
} | ||
} |
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,23 @@ | ||
import type { CognitoTranslationMessages } from 'ra-auth-cognito'; | ||
|
||
export const raAuthCognitoEnglishMessages: CognitoTranslationMessages = { | ||
ra: { | ||
auth: { | ||
cognito: { | ||
mfa: { | ||
totp: { | ||
association_helper_text: | ||
'Enter the verification code generated by your authenticator app to complete the association.', | ||
association_label: 'Verification code', | ||
association_required: | ||
'Two-factor authentication required, please associate a TOTP authenticator app (2FA) to your account by scanning the QR code or entering the secret key.', | ||
copy_totp_url_to_clipboard: | ||
'Copy secret key to clipboard', | ||
label: 'Verification code from your authenticator app', | ||
}, | ||
}, | ||
require_new_password: 'Please enter a new password', | ||
}, | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.