diff --git a/README.md b/README.md index 140a21c87f..4219ee5e27 100644 --- a/README.md +++ b/README.md @@ -31,3 +31,4 @@ - cozy-mespapiers-lib : lib has been merged again in [mespapiers](https://github.com/cozy/mespapiers) in 2024. Last commit where it exists in this repo: `b49bd1f6b71446235b2c5a702a13584765787ce8`. [Removal PR](https://github.com/cozy/cozy-libs/pull/2641). - cozy-scanner : lib was used for qualifications that are now in [cozy-client](https://github.com/cozy/cozy-client). Last commit where it exists in this repo: `cd79f20a4c2e807ec57893548594e2a5f430eba7`. [Removal PR](https://github.com/cozy/cozy-libs/pull/2649). +- cozy-authentication : lib was used for our Cordova apps that have been replaced by the flagship app in React Native. Last commit where it exists in this repo: `de46949c3e4f85e262786f71ec9e4a5699ec319b`. [Removal PR](https://github.com/cozy/cozy-libs/pull/2650). diff --git a/packages/cozy-authentication/.gitignore b/packages/cozy-authentication/.gitignore deleted file mode 100644 index d757f56df5..0000000000 --- a/packages/cozy-authentication/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.cache -dist/ diff --git a/packages/cozy-authentication/CHANGELOG.md b/packages/cozy-authentication/CHANGELOG.md deleted file mode 100644 index d4f3572ebb..0000000000 --- a/packages/cozy-authentication/CHANGELOG.md +++ /dev/null @@ -1,873 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## 3.6.1 (2024-11-06) - - -### Bug Fixes - -* Rename cozy-dataproxy to cozy-dataproxy-lib ([635d421](https://github.com/cozy/cozy-libs/commit/635d421045fc0374ca88cd68ec4941c95c40a0dd)) - - - - - -# 3.6.0 (2024-11-06) - - -### Features - -* Upgrade cozy-client and cozy-pouch-link ([67f5241](https://github.com/cozy/cozy-libs/commit/67f5241754e0472a991dad3e5fafd0b1c5edb9c6)), closes [cozy/cozy-client#1553](https://github.com/cozy/cozy-client/issues/1553) [cozy/cozy-client#1556](https://github.com/cozy/cozy-client/issues/1556) - - - - - -# 3.5.0 (2024-11-06) - - -### Features - -* **cozy-devtools:** Remove logs and use hook to get `client` ([df87cf5](https://github.com/cozy/cozy-libs/commit/df87cf500edacae42c55c4bbf710fa2e55ea8ba3)) - - - - - -# 3.4.0 (2024-11-06) - - -### Features - -* **cozy-devtools:** Add first version to test providers ([5689640](https://github.com/cozy/cozy-libs/commit/568964008bb657dfaf8038ac2d9fa3dca8d3eb1c)) - - - - - -## 3.3.1 (2024-11-05) - -**Note:** Version bump only for package cozy-authentication - - - - - -# 3.3.0 (2024-10-30) - - -### Features - -* Update deps for cozy-viewer ([b2e103a](https://github.com/cozy/cozy-libs/commit/b2e103a1280182881ae1133860c0a09650271920)) - - - - - -# 3.2.0 (2024-10-30) - - -### Features - -* Download file on mobile viewer on press ([3c38062](https://github.com/cozy/cozy-libs/commit/3c38062e2c83d5b8f7d0065323c18d45b5ce9564)) - - - - - -# 3.1.0 (2024-10-25) - - -### Features - -* **Viewer:** Replace Encrypted provider by cozy-ui one ([aa81d02](https://github.com/cozy/cozy-libs/commit/aa81d02f0a70de8044f704cbd895b1d54c9f38b8)) - - - - - -## 3.0.4 (2024-10-23) - -**Note:** Version bump only for package cozy-authentication - - - - - -## 3.0.3 (2024-10-16) - -**Note:** Version bump only for package cozy-authentication - - - - - -## [3.0.2](https://github.com/cozy/cozy-libs/compare/cozy-authentication@3.0.1...cozy-authentication@3.0.2) (2024-10-15) - -**Note:** Version bump only for package cozy-authentication - - - - - -## 3.0.1 (2024-09-09) - -**Note:** Version bump only for package cozy-authentication - -# 3.0.0 (2023-08-23) - -### Features - -- **harvest:** Update cozy-client from `38.6.0` to `40.2.0` ([8931b15](https://github.com/cozy/cozy-libs/commit/8931b15ba7b097bf829601d6042d5e522b7f2fd6)) - -### BREAKING CHANGES - -- **harvest:** you must have `cozy-client >= 40.2.0` - -# 2.14.0 (2023-04-17) - -### Features - -- Add missing devDeps to cozy-authentication ([94832ed](https://github.com/cozy/cozy-libs/commit/94832ed1c1c2934de408f02929f4ea30cba28a2c)) - -# 2.13.0 (2023-01-31) - -### Features - -- Update cozy-client and cozy-ui ([6ae3b04](https://github.com/cozy/cozy-libs/commit/6ae3b04925ae64fa30f3ec8b6e716453d0a630fe)) - -## [2.12.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.12.0...cozy-authentication@2.12.1) (2023-01-06) - -### Bug Fixes - -- **authentication:** Pass the `history` object back to `onAuthenticated` ([4b4d066](https://github.com/cozy/cozy-libs/commit/4b4d0667afbec6328588db301a5150ab03596fff)) - -# [2.12.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.11.0...cozy-authentication@2.12.0) (2022-12-23) - -### Features - -- **authentication:** Add an alternate implementation for `MobileRouter` ([07436c0](https://github.com/cozy/cozy-libs/commit/07436c045a49c8cbb484fd0126be8596a838f986)) -- **authentication:** Add react-router-dom 6.4.1 as a dependency ([491f723](https://github.com/cozy/cozy-libs/commit/491f72375c7e6793a7360cbd3bc9f5b6421777e0)) - -# 2.11.0 (2022-12-20) - -### Features - -- Add `illustrationSize` prop to paperConfiguration ([d0b8524](https://github.com/cozy/cozy-libs/commit/d0b852479ff95100a6c1c0b7d3f6271e8859cc40)) -- Remove pk_campaign query string in links ([86cac7e](https://github.com/cozy/cozy-libs/commit/86cac7e6c76e036b459b48e3aabe0ecd5f8d1e8e)) - -## 2.10.11 (2022-11-14) - -**Note:** Version bump only for package cozy-authentication - -## [2.10.10](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.10.9...cozy-authentication@2.10.10) (2022-10-11) - -### Bug Fixes - -- This.input is not defined ([1ba6a4d](https://github.com/cozy/cozy-libs/commit/1ba6a4d97d898e0f43f7ca9bd53aba6aff1405af)) - -## [2.10.9](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.10.8...cozy-authentication@2.10.9) (2022-10-03) - -**Note:** Version bump only for package cozy-authentication - -## 2.10.8 (2022-10-03) - -**Note:** Version bump only for package cozy-authentication - -## [2.10.7](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.10.6...cozy-authentication@2.10.7) (2022-09-12) - -**Note:** Version bump only for package cozy-authentication - -## [2.10.6](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.10.5...cozy-authentication@2.10.6) (2022-09-06) - -**Note:** Version bump only for package cozy-authentication - -## 2.10.5 (2022-08-29) - -### Bug Fixes - -- Add prepublish script ([30a26e5](https://github.com/cozy/cozy-libs/commit/30a26e5109dcdfc636c76e6cdd20fdec313359ee)) - -## 2.10.4 (2022-08-01) - -**Note:** Version bump only for package cozy-authentication - -## [2.10.3](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.10.2...cozy-authentication@2.10.3) (2022-07-05) - -### Bug Fixes - -- Lint issue ([8523d7a](https://github.com/cozy/cozy-libs/commit/8523d7accbe7ee83b6a2fe7abf4cc629fcd76e61)) - -## [2.10.2](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.10.1...cozy-authentication@2.10.2) (2022-07-01) - -### Bug Fixes - -- **deps:** update dependency parcel to v1.12.4 ([9cc6637](https://github.com/cozy/cozy-libs/commit/9cc66373943b0383110cf0bd13173343c34d926b)) - -## 2.10.1 (2022-06-24) - -**Note:** Version bump only for package cozy-authentication - -# 2.10.0 (2022-06-03) - -### Features - -- **harvest:** HandleOAuthResponse can deal with cozy-data from DOM ([7c6ac1a](https://github.com/cozy/cozy-libs/commit/7c6ac1a8de7dd2b136530d0aafdb1e3f9e28fa56)) - -## [2.9.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.9.0...cozy-authentication@2.9.1) (2022-05-10) - -**Note:** Version bump only for package cozy-authentication - -# 2.9.0 (2022-05-09) - -### Bug Fixes - -- bump react-dom from 16.12.0 to 16.13.0 ([2a5b850](https://github.com/cozy/cozy-libs/commit/2a5b8509555f061b136a4b5f2e38b36eb75ea0be)) - -### Features - -- Add papers filter on Home ([fd839dc](https://github.com/cozy/cozy-libs/commit/fd839dc6d2538799d8dafc1905d423410c251df6)) - -## [2.8.5](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.8.4...cozy-authentication@2.8.5) (2022-04-28) - -**Note:** Version bump only for package cozy-authentication - -## [2.8.4](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.8.3...cozy-authentication@2.8.4) (2022-04-25) - -**Note:** Version bump only for package cozy-authentication - -## 2.8.3 (2022-04-11) - -### Bug Fixes - -- bump react-router from 3.2.4 to 6.3.0 ([a1adf7b](https://github.com/cozy/cozy-libs/commit/a1adf7bf4db360b67b2804f7e04e08ef3d202a03)) -- Open modal with background content ([4f670ca](https://github.com/cozy/cozy-libs/commit/4f670ca38939df94973f391a1cc9318ff419b6a0)) - -## 2.8.2 (2022-04-01) - -### Bug Fixes - -- **deps:** update dependency cssnano-preset-advanced to v4.0.8 ([9594a5c](https://github.com/cozy/cozy-libs/commit/9594a5c3cfa7800eee3bea2c5002b848d2b5e1af)) -- **sharing:** Upgrade cozy-ui to remove justifyContent warning ([eb6318f](https://github.com/cozy/cozy-libs/commit/eb6318f0d0cd2e39e47b80b35e30efb766d6e553)) - -## [2.8.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.8.0...cozy-authentication@2.8.1) (2022-02-18) - -### Bug Fixes - -- **deps:** pin dependencies ([e53d065](https://github.com/cozy/cozy-libs/commit/e53d065090224ea340b2c25c3afd14f223f4d119)) - -# [2.8.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.7.10...cozy-authentication@2.8.0) (2022-02-14) - -### Features - -- **sharing:** Upgrade cozy-ui to benefit of new component ([db7490b](https://github.com/cozy/cozy-libs/commit/db7490ba5f1585e2a925f5c054aa611c93617bdc)) - -## [2.7.10](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.7.9...cozy-authentication@2.7.10) (2022-02-04) - -**Note:** Version bump only for package cozy-authentication - -## [2.7.9](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.7.8...cozy-authentication@2.7.9) (2022-02-03) - -### Bug Fixes - -- **deps:** update dependency jest to v26.6.3 ([f442fff](https://github.com/cozy/cozy-libs/commit/f442fff5f594f04f910046d971950023fcbdd958)) - -## [2.7.8](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.7.7...cozy-authentication@2.7.8) (2022-02-01) - -### Bug Fixes - -- **deps:** update babel monorepo ([dcc215a](https://github.com/cozy/cozy-libs/commit/dcc215a0478db2cb3175b09d759bce8153ad4000)) - -## [2.7.7](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.7.6...cozy-authentication@2.7.7) (2022-01-28) - -**Note:** Version bump only for package cozy-authentication - -## [2.7.6](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.7.5...cozy-authentication@2.7.6) (2022-01-19) - -**Note:** Version bump only for package cozy-authentication - -## [2.7.5](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.7.4...cozy-authentication@2.7.5) (2022-01-07) - -**Note:** Version bump only for package cozy-authentication - -## [2.7.4](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.7.3...cozy-authentication@2.7.4) (2022-01-06) - -**Note:** Version bump only for package cozy-authentication - -## [2.7.3](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.7.2...cozy-authentication@2.7.3) (2021-12-28) - -**Note:** Version bump only for package cozy-authentication - -## [2.7.2](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.7.1...cozy-authentication@2.7.2) (2021-12-20) - -**Note:** Version bump only for package cozy-authentication - -## [2.7.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.7.0...cozy-authentication@2.7.1) (2021-12-02) - -**Note:** Version bump only for package cozy-authentication - -# 2.7.0 (2021-10-22) - -### Features - -- Remove drive from homeHref ([97010d3](https://github.com/cozy/cozy-libs/commit/97010d3)) - -## [2.6.3](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.6.2...cozy-authentication@2.6.3) (2021-09-03) - -### Bug Fixes - -- **deps:** update dependency cozy-client to v13.21.0 ([f46c241](https://github.com/cozy/cozy-libs/commit/f46c241)) - -## [2.6.2](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.6.1...cozy-authentication@2.6.2) (2021-05-06) - -**Note:** Version bump only for package cozy-authentication - -## 2.6.1 (2021-04-14) - -### Bug Fixes - -- Remove url to old unavailable blog post ([4cfb38a](https://github.com/cozy/cozy-libs/commit/4cfb38a)) -- Update cozy-authentication address placeholder in french ([3df4ac8](https://github.com/cozy/cozy-libs/commit/3df4ac8)) - -# 2.6.0 (2021-02-12) - -### Features - -- Add finance theme ([bb8cf35](https://github.com/cozy/cozy-libs/commit/bb8cf35)) - -# [2.5.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.4.1...cozy-authentication@2.5.0) (2020-11-30) - -### Features - -- Update cozy-ui minimal versions ([7e7755f](https://github.com/cozy/cozy-libs/commit/7e7755f)) -- Use svgr icons in cozy-authentication ([13ca3ec](https://github.com/cozy/cozy-libs/commit/13ca3ec)) - -## [2.4.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.4.0...cozy-authentication@2.4.1) (2020-11-25) - -### Bug Fixes - -- Remove import to stylesheet ([39c6114](https://github.com/cozy/cozy-libs/commit/39c6114)) - -# [2.4.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.3.3...cozy-authentication@2.4.0) (2020-11-23) - -### Features - -- All babel cli at 7.12.1 ([387a24a](https://github.com/cozy/cozy-libs/commit/387a24a)) -- Remove react-redux from cozy-authentication deps ([a6c0138](https://github.com/cozy/cozy-libs/commit/a6c0138)) -- Simplify transpilation of cozy-authentication ([696e8a9](https://github.com/cozy/cozy-libs/commit/696e8a9)) -- Update @babel/core and babel-jest ([352ddc3](https://github.com/cozy/cozy-libs/commit/352ddc3)) -- Update jest ([3b2c32a](https://github.com/cozy/cozy-libs/commit/3b2c32a)) -- Use >= for peer dependencies ([6ec2826](https://github.com/cozy/cozy-libs/commit/6ec2826)) - -## [2.3.3](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.3.2...cozy-authentication@2.3.3) (2020-11-11) - -**Note:** Version bump only for package cozy-authentication - -## [2.3.2](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.3.1...cozy-authentication@2.3.2) (2020-10-01) - -### Bug Fixes - -- Lint issue ([aa10617](https://github.com/cozy/cozy-libs/commit/aa10617)) - -## [2.3.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.3.0...cozy-authentication@2.3.1) (2020-09-15) - -**Note:** Version bump only for package cozy-authentication - -# [2.3.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.2.2...cozy-authentication@2.3.0) (2020-08-21) - -### Features - -- Update cozy-ui across all libs ([73549b0](https://github.com/cozy/cozy-libs/commit/73549b0)) - -## [2.2.2](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.2.1...cozy-authentication@2.2.2) (2020-08-03) - -**Note:** Version bump only for package cozy-authentication - -## [2.2.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.2.0...cozy-authentication@2.2.1) (2020-07-21) - -### Bug Fixes - -- Use same Cozy-UI and CozyClient version everywhere ([6216e62](https://github.com/cozy/cozy-libs/commit/6216e62)) - -# [2.2.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.1.1...cozy-authentication@2.2.0) (2020-07-20) - -### Features - -- Update cozy-client ([14ca0b9](https://github.com/cozy/cozy-libs/commit/14ca0b9)) -- Update cozy-ui ([a8710f9](https://github.com/cozy/cozy-libs/commit/a8710f9)) - -## [2.1.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.1.0...cozy-authentication@2.1.1) (2020-07-17) - -**Note:** Version bump only for package cozy-authentication - -# [2.1.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.0.11...cozy-authentication@2.1.0) (2020-07-17) - -### Features - -- Extract wizard to cozy-ui ([70b8c38](https://github.com/cozy/cozy-libs/commit/70b8c38)) -- Update cozy-client as dev dep for cozy-authentication ([98b34e0](https://github.com/cozy/cozy-libs/commit/98b34e0)) - -## 2.0.11 (2020-07-16) - -### Bug Fixes - -- Call revokeSelf if not the owner of the sharing ([f7afc60](https://github.com/cozy/cozy-libs/commit/f7afc60)) - -## [2.0.10](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.0.9...cozy-authentication@2.0.10) (2020-02-27) - -**Note:** Version bump only for package cozy-authentication - -## [2.0.9](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.0.8...cozy-authentication@2.0.9) (2020-02-25) - -**Note:** Version bump only for package cozy-authentication - -## [2.0.8](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.0.7...cozy-authentication@2.0.8) (2020-02-24) - -**Note:** Version bump only for package cozy-authentication - -## [2.0.7](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.0.6...cozy-authentication@2.0.7) (2020-02-17) - -**Note:** Version bump only for package cozy-authentication - -## [2.0.6](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.0.5...cozy-authentication@2.0.6) (2020-02-17) - -**Note:** Version bump only for package cozy-authentication - -## [2.0.5](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.0.4...cozy-authentication@2.0.5) (2019-12-31) - -### Bug Fixes - -- Add string to create sync folder ([3c192ae](https://github.com/cozy/cozy-libs/commit/3c192ae)) - -## 2.0.4 (2019-12-13) - -### Bug Fixes - -- Use camelCase ([b3e2b54](https://github.com/cozy/cozy-libs/commit/b3e2b54)) - -## [2.0.3](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.0.2...cozy-authentication@2.0.3) (2019-11-06) - -**Note:** Version bump only for package cozy-authentication - -## [2.0.2](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.0.1...cozy-authentication@2.0.2) (2019-11-06) - -**Note:** Version bump only for package cozy-authentication - -## [2.0.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@2.0.0...cozy-authentication@2.0.1) (2019-11-06) - -**Note:** Version bump only for package cozy-authentication - -# 2.0.0 (2019-11-05) - -### Bug Fixes - -- **cozy-auth:** Don't display appRoute too soon ([521b817](https://github.com/cozy/cozy-libs/commit/521b817)) -- **cozy-auth:** Don't redirect everytime we loged in ([03cfd32](https://github.com/cozy/cozy-libs/commit/03cfd32)) - -### BREAKING CHANGES - -- **cozy-auth:** Each time we try to reconnect from localStorage, we redirect - to loginPath (defaulted to /). It works great for application - that doesn't have to handle deeplinking for instance, but not - for them. - -Since we can't be sure that `handleDeeplink` is called after `handleAfterLogin` -we can have a race condition between the both method resulting to redirecting -the user to loginPath instead of the url provided by the deeplink. - -To prevent this issue, we should not redirect to loginPath in cozy-auth and -let the application does what she wants after a loggin. - -In order to upgrade your app your need to change how you instantiate -the `MobileRouter`: - -- remove the `loginPath` prop -- in the `onAuthenticated` callback you need to manually push to your previous - loginPath (ie router.push('/afterLogin')) - -## [1.19.2](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.19.1...cozy-authentication@1.19.2) (2019-09-18) - -**Note:** Version bump only for package cozy-authentication - -## [1.19.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.19.0...cozy-authentication@1.19.1) (2019-09-13) - -**Note:** Version bump only for package cozy-authentication - -# 1.19.0 (2019-09-05) - -### Features - -- Add account route ([7986708](https://github.com/cozy/cozy-libs/commit/7986708)) - -## [1.18.2](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.18.1...cozy-authentication@1.18.2) (2019-09-04) - -**Note:** Version bump only for package cozy-authentication - -## [1.18.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.18.0...cozy-authentication@1.18.1) (2019-09-04) - -**Note:** Version bump only for package cozy-authentication - -# [1.18.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.17.5...cozy-authentication@1.18.0) (2019-09-03) - -### Features - -- Use snarkdown instead of react markdown ([9350d12](https://github.com/cozy/cozy-libs/commit/9350d12)) - -## [1.17.5](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.17.4...cozy-authentication@1.17.5) (2019-09-02) - -**Note:** Version bump only for package cozy-authentication - -## [1.17.4](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.17.3...cozy-authentication@1.17.4) (2019-08-29) - -**Note:** Version bump only for package cozy-authentication - -## [1.17.3](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.17.2...cozy-authentication@1.17.3) (2019-08-27) - -**Note:** Version bump only for package cozy-authentication - -## [1.17.2](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.17.1...cozy-authentication@1.17.2) (2019-08-23) - -### Bug Fixes - -- Add moduleNameMapper for the new CC version ([9ac4a26](https://github.com/cozy/cozy-libs/commit/9ac4a26)) - -## 1.17.1 (2019-08-23) - -### Bug Fixes - -- Reset yarn lockfile ([24a9993](https://github.com/cozy/cozy-libs/commit/24a9993)) - -# [1.17.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.16.2...cozy-authentication@1.17.0) (2019-07-19) - -### Features - -- Activate babel helpers by default ([ab62bdb](https://github.com/cozy/cozy-libs/commit/ab62bdb)) - -## [1.16.2](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.16.1...cozy-authentication@1.16.2) (2019-07-19) - -**Note:** Version bump only for package cozy-authentication - -## [1.16.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.16.0...cozy-authentication@1.16.1) (2019-07-18) - -**Note:** Version bump only for package cozy-authentication - -# [1.16.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.15.2...cozy-authentication@1.16.0) (2019-07-16) - -### Bug Fixes - -- **cozy-authentication:** Await CozyClient::login ([7aa27f5](https://github.com/cozy/cozy-libs/commit/7aa27f5)) - -### Features - -- **cozy-authentication:** Call onAuthenticated before redirecting ([ab5e273](https://github.com/cozy/cozy-libs/commit/ab5e273)) - -## [1.15.2](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.15.1...cozy-authentication@1.15.2) (2019-07-12) - -### Bug Fixes - -- **cozy-authentication:** Don't show icon and spinner at the same time ([cbd3342](https://github.com/cozy/cozy-libs/commit/cbd3342)) - -## [1.15.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.15.0...cozy-authentication@1.15.1) (2019-07-12) - -### Bug Fixes - -- **cozy-authentication:** Force apply the back button styles ([a9a2fda](https://github.com/cozy/cozy-libs/commit/a9a2fda)) - -# [1.15.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.14.1...cozy-authentication@1.15.0) (2019-07-11) - -### Bug Fixes - -- **cozy-authentication:** Update cozy-ui to v22.3.0 ([4188303](https://github.com/cozy/cozy-libs/commit/4188303)) - -### Features - -- **SelectServer:** Back button is not fixed anymore ([c3ba652](https://github.com/cozy/cozy-libs/commit/c3ba652)) - -## 1.14.1 (2019-07-11) - -**Note:** Version bump only for package cozy-authentication - -# [1.14.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.13.3...cozy-authentication@1.14.0) (2019-06-26) - -### Features - -- **auth:** Update cozy-ui ([40f036d](https://github.com/cozy/cozy-libs/commit/40f036d)) - -## [1.13.3](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.13.2...cozy-authentication@1.13.3) (2019-06-12) - -**Note:** Version bump only for package cozy-authentication - - - -## [1.13.2](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.13.1...cozy-authentication@1.13.2) (2019-06-03) - -**Note:** Version bump only for package cozy-authentication - - - -## [1.13.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.13.0...cozy-authentication@1.13.1) (2019-05-17) - -**Note:** Version bump only for package cozy-authentication - - - -# [1.13.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.12.5...cozy-authentication@1.13.0) (2019-05-06) - -### Features - -- Prevent flash of Authentication view ([835ce0b](https://github.com/cozy/cozy-libs/commit/835ce0b)) -- Show view while logging in ([3fef80a](https://github.com/cozy/cozy-libs/commit/3fef80a)) - - - -## [1.12.5](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.12.4...cozy-authentication@1.12.5) (2019-05-03) - -**Note:** Version bump only for package cozy-authentication - - - -## [1.12.4](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.12.3...cozy-authentication@1.12.4) (2019-05-02) - -### Bug Fixes - -- HandleOpenURL on universalLink if MobileRouter does not manage it ([b8f5f55](https://github.com/cozy/cozy-libs/commit/b8f5f55)) - - - -## [1.12.3](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.12.2...cozy-authentication@1.12.3) (2019-05-02) - -### Bug Fixes - -- Client login takes uri, not url ([c4d5ecb](https://github.com/cozy/cozy-libs/commit/c4d5ecb)) - - - -## [1.12.2](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.12.1...cozy-authentication@1.12.2) (2019-05-02) - -### Bug Fixes - -- Do not try to onboarding if required query argument are absent ([244af9d](https://github.com/cozy/cozy-libs/commit/244af9d)) - - - -## [1.12.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.12.0...cozy-authentication@1.12.1) (2019-05-02) - -**Note:** Version bump only for package cozy-authentication - - - -# [1.12.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.11.0...cozy-authentication@1.12.0) (2019-05-02) - -### Features - -- Ability to override components ([2f09fbe](https://github.com/cozy/cozy-libs/commit/2f09fbe)) -- Export ButtonLinkRegistration for overrides ([6d4e6c5](https://github.com/cozy/cozy-libs/commit/6d4e6c5)) - - - -# [1.11.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.10.0...cozy-authentication@1.11.0) (2019-05-02) - -### Features - -- Override url manager ([#420](https://github.com/cozy/cozy-libs/issues/420)) ([84dbf3d](https://github.com/cozy/cozy-libs/commit/84dbf3d)) - - - -# [1.10.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.9.1...cozy-authentication@1.10.0) (2019-05-02) - -### Features - -- Add appSlug and UL listeners ([1b0ae4f](https://github.com/cozy/cozy-libs/commit/1b0ae4f)) -- Universal Links ([5652388](https://github.com/cozy/cozy-libs/commit/5652388)) - - - -## [1.9.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.9.0...cozy-authentication@1.9.1) (2019-05-02) - -### Bug Fixes - -- doOnboardingLogin called client.login with url instead of uri ([a57d59d](https://github.com/cozy/cozy-libs/commit/a57d59d)) - - - -# [1.9.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.8.0...cozy-authentication@1.9.0) (2019-05-02) - -### Bug Fixes - -- Use real I18n in test ([ec86c87](https://github.com/cozy/cozy-libs/commit/ec86c87)) - -### Features - -- Ability to display a LogoutComponent while logging out ([51e5754](https://github.com/cozy/cozy-libs/commit/51e5754)) -- Add cozy-client as peerDependency ([393956d](https://github.com/cozy/cozy-libs/commit/393956d)) - - - -# [1.8.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.7.0...cozy-authentication@1.8.0) (2019-04-30) - -### Bug Fixes - -- Must unregister client in case of error ([89ca7f5](https://github.com/cozy/cozy-libs/commit/89ca7f5)) -- Setup does not take client in argument ([23e5226](https://github.com/cozy/cozy-libs/commit/23e5226)) - -### Features - -- Reconnect client ([bb24df7](https://github.com/cozy/cozy-libs/commit/bb24df7)) -- Show informations ([6f229ff](https://github.com/cozy/cozy-libs/commit/6f229ff)) - - - -# [1.7.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.6.1...cozy-authentication@1.7.0) (2019-04-30) - -### Bug Fixes - -- Missing dependency ([93493d8](https://github.com/cozy/cozy-libs/commit/93493d8)) -- Missing translation strings ([7ac7f66](https://github.com/cozy/cozy-libs/commit/7ac7f66)) - -### Features - -- Add buttons to change lang ([9de8017](https://github.com/cozy/cozy-libs/commit/9de8017)) -- Add second context of translation to mimic real app ([cecdfff](https://github.com/cozy/cozy-libs/commit/cecdfff)) -- MobileRouter brings its own translation context ([c1be7af](https://github.com/cozy/cozy-libs/commit/c1be7af)) - - - -## [1.6.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.6.0...cozy-authentication@1.6.1) (2019-04-30) - -### Bug Fixes - -- generateOnboardingQueryPart does clear of local state/secret ([d4390dd](https://github.com/cozy/cozy-libs/commit/d4390dd)) -- Typo in policy_uri argument ([c19bf3a](https://github.com/cozy/cozy-libs/commit/c19bf3a)) - - - -# [1.6.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.5.6...cozy-authentication@1.6.0) (2019-04-29) - -### Bug Fixes - -- Add label to previous button ([9a78499](https://github.com/cozy/cozy-libs/commit/9a78499)) -- After log back in, register AND login ([beceea5](https://github.com/cozy/cozy-libs/commit/beceea5)) -- Authentication needs to call login ([db8c697](https://github.com/cozy/cozy-libs/commit/db8c697)) -- Bad import, better test ([fcfc206](https://github.com/cozy/cozy-libs/commit/fcfc206)) -- Do not setState when component is unmounted ([865fada](https://github.com/cozy/cozy-libs/commit/865fada)) -- Export enhanced MobileRouter ([340e0be](https://github.com/cozy/cozy-libs/commit/340e0be)) -- Make example compile ([c2f6405](https://github.com/cozy/cozy-libs/commit/c2f6405)) -- Missing import ([3e4d712](https://github.com/cozy/cozy-libs/commit/3e4d712)) -- MObileRouter ([27e47d7](https://github.com/cozy/cozy-libs/commit/27e47d7)) -- Remove warning for revoked client ([45daf43](https://github.com/cozy/cozy-libs/commit/45daf43)) -- Repair Authentication test ([0853e16](https://github.com/cozy/cozy-libs/commit/0853e16)) -- Typo ([9e712e0](https://github.com/cozy/cozy-libs/commit/9e712e0)) -- Update propTypes ([8f99437](https://github.com/cozy/cozy-libs/commit/8f99437)) -- Use boolean attribute for disabled ([1a9788c](https://github.com/cozy/cozy-libs/commit/1a9788c)) - -### Features - -- Ability to configure login/logout path + onAuthenticated ([ada467a](https://github.com/cozy/cozy-libs/commit/ada467a)) -- Add links to README ([b5355bb](https://github.com/cozy/cozy-libs/commit/b5355bb)) -- Add script to generate URL that will redirect to /auth ([77ca7a7](https://github.com/cozy/cozy-libs/commit/77ca7a7)) -- Allow to use props.children instead of appRoutes ([963f3ab](https://github.com/cozy/cozy-libs/commit/963f3ab)) -- appRoutes or children can be used for Routes ([29c4f8e](https://github.com/cozy/cozy-libs/commit/29c4f8e)) -- Do not destructure oauth options, pass as is ([b326462](https://github.com/cozy/cozy-libs/commit/b326462)) -- Example improvements ([92f3364](https://github.com/cozy/cozy-libs/commit/92f3364)) -- Handling deep links in MobileRouter ([9021faf](https://github.com/cozy/cozy-libs/commit/9021faf)) -- Listen to client events ([c46ed98](https://github.com/cozy/cozy-libs/commit/c46ed98)) -- MobileRouter supports appTitle ([d161abd](https://github.com/cozy/cozy-libs/commit/d161abd)) -- Move MobileRouter ([2da60da](https://github.com/cozy/cozy-libs/commit/2da60da)) -- No more client-compat ([d3e8baf](https://github.com/cozy/cozy-libs/commit/d3e8baf)) -- No prop drill thanks to withClient ([6062470](https://github.com/cozy/cozy-libs/commit/6062470)) -- Rename .babelrc to babel.config.js ([ba00688](https://github.com/cozy/cozy-libs/commit/ba00688)), closes [/github.com/facebook/jest/issues/6053#issuecomment-383632515](https://github.com//github.com/facebook/jest/issues/6053/issues/issuecomment-383632515) -- Repair tests and display nothing when logging in via onboarding ([b1d2025](https://github.com/cozy/cozy-libs/commit/b1d2025)) -- Spaces ([ebdfed5](https://github.com/cozy/cozy-libs/commit/ebdfed5)) -- Update cozy-client ([cb5f798](https://github.com/cozy/cozy-libs/commit/cb5f798)) -- Use client attributes to show Authentication/Revoked ([5523bee](https://github.com/cozy/cozy-libs/commit/5523bee)) - - - -## [1.5.6](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.5.5...cozy-authentication@1.5.6) (2019-04-17) - -**Note:** Version bump only for package cozy-authentication - - - -## [1.5.5](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.5.4...cozy-authentication@1.5.5) (2019-04-16) - -**Note:** Version bump only for package cozy-authentication - - - -## [1.5.4](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.5.3...cozy-authentication@1.5.4) (2019-04-15) - -### Bug Fixes - -- Move OnboardingPropTypes and MobileRouter to be transpiled ([f9572f5](https://github.com/cozy/cozy-libs/commit/f9572f5)) - - - -## [1.5.3](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.5.2...cozy-authentication@1.5.3) (2019-04-15) - -### Bug Fixes - -- Add localforage as dep ([119f995](https://github.com/cozy/cozy-libs/commit/119f995)) -- Don't use drive lib logger ([480dae6](https://github.com/cozy/cozy-libs/commit/480dae6)) -- Lang loader ([0d84285](https://github.com/cozy/cozy-libs/commit/0d84285)) -- Upgrade Auth ([b1fe87b](https://github.com/cozy/cozy-libs/commit/b1fe87b)) -- Use client-compat ([7a84bb9](https://github.com/cozy/cozy-libs/commit/7a84bb9)) -- Use transpiled version of UI ([ad323ef](https://github.com/cozy/cozy-libs/commit/ad323ef)) - - - -## [1.5.2](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.5.1...cozy-authentication@1.5.2) (2019-04-12) - -**Note:** Version bump only for package cozy-authentication - - - -## [1.5.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.5.0...cozy-authentication@1.5.1) (2019-03-29) - -**Note:** Version bump only for package cozy-authentication - - - -# [1.5.0](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.4.4...cozy-authentication@1.5.0) (2019-03-29) - -### Features - -- **auth:** Should render custom components ([d6325a9](https://github.com/cozy/cozy-libs/commit/d6325a9)) - - - -## [1.4.4](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.4.3...cozy-authentication@1.4.4) (2019-03-28) - -### Bug Fixes - -- Use correct attribute for autoFocus ([ff5f802](https://github.com/cozy/cozy-libs/commit/ff5f802)) - - - -## [1.4.3](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.4.2...cozy-authentication@1.4.3) (2019-03-25) - -**Note:** Version bump only for package cozy-authentication - - - -## [1.4.2](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.4.1...cozy-authentication@1.4.2) (2019-03-19) - -### Bug Fixes - -- **cozy-authentication:** Remove lock file ([#349](https://github.com/cozy/cozy-libs/issues/349)) ([ec3a7de](https://github.com/cozy/cozy-libs/commit/ec3a7de)) - - - -## [1.4.1](https://github.com/cozy/cozy-libs/compare/cozy-authentication@1.4.0...cozy-authentication@1.4.1) (2019-03-18) - -**Note:** Version bump only for package cozy-authentication - - - -# 1.4.0 (2019-03-15) - -### Features - -- Add cozy-authentication ([632e034](https://github.com/cozy/cozy-libs/commit/632e034)) diff --git a/packages/cozy-authentication/OnboardingPropTypes.js b/packages/cozy-authentication/OnboardingPropTypes.js deleted file mode 100644 index 95f5fd2614..0000000000 --- a/packages/cozy-authentication/OnboardingPropTypes.js +++ /dev/null @@ -1,21 +0,0 @@ -import Proptypes from 'prop-types' - -export const onboardingInformationsPropTypes = Proptypes.shape({ - code: Proptypes.string, - state: Proptypes.string, - cozy_url: Proptypes.string -}) - -export const onboardingPropTypes = Proptypes.shape({ - auth: Proptypes.shape({ - clientKind: Proptypes.string.isRequired, - clientName: Proptypes.string.isRequired, - clientURI: Proptypes.string.isRequired, - logoURI: Proptypes.string.isRequired, - policyURI: Proptypes.string.isRequired, - redirectURI: Proptypes.string.isRequired, - scope: Proptypes.array.isRequired, - softwareID: Proptypes.string.isRequired, - softwareVersion: Proptypes.string.isRequired - }) -}) diff --git a/packages/cozy-authentication/Procfile b/packages/cozy-authentication/Procfile deleted file mode 100644 index 209251ffdd..0000000000 --- a/packages/cozy-authentication/Procfile +++ /dev/null @@ -1,2 +0,0 @@ -example-server: yarn example-server -transpilation: yarn build --watch diff --git a/packages/cozy-authentication/README.md b/packages/cozy-authentication/README.md deleted file mode 100644 index d767f02bc3..0000000000 --- a/packages/cozy-authentication/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# [Cozy][cozy] Authentication component - -## What's cozy-authentication - -Cozy-Authentication is a React component used to authenticate to a Cozy. It acts as a login page. - -## What's Cozy? - -![Cozy Logo](https://cdn.rawgit.com/cozy/cozy-guidelines/master/templates/cozy_logo_small.svg) - -[Cozy][cozy] is a platform that brings all your web services in the same private space. With it, your webapps and your devices can share data easily, providing you with a new experience. You can install Cozy on your own hardware where no one's tracking you. - -## Contribute - -If you want to work on cozy-authentication itself and submit code modifications, feel free to open pull-requests! See the [contributing guide][contribute] for more information about this repository structure, testing, linting and how to properly open pull-requests. - -## Community - -### Get in touch - -You can reach the Cozy Community by: - -- Chatting with us on IRC [#cozycloud on Libera.Chat][libera] -- Posting on our [Forum][forum] -- Posting issues on the [Github repos][github] -- Say Hi! on [Twitter][twitter] - -## Licence - -cozy-authentication is developed by Cozy Cloud and distributed under the [MIT][]. - -[cozy]: https://cozy.io "Cozy Cloud" - -[MIT]: https://opensource.org/licenses/MIT - -[contribute]: CONTRIBUTING.md - -[libera]: https://web.libera.chat/#cozycloud - -[forum]: https://forum.cozy.io/ - -[github]: https://github.com/cozy/ - -[twitter]: https://twitter.com/mycozycloud diff --git a/packages/cozy-authentication/babel.config.js b/packages/cozy-authentication/babel.config.js deleted file mode 100644 index 44d0d99159..0000000000 --- a/packages/cozy-authentication/babel.config.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - env: { - transpilation: { - presets: [['cozy-app', { lib: true }]] - }, - test: { - presets: ['cozy-app'] - } - }, - ignore: ['*.spec.js', '*.spec.jsx'] -} diff --git a/packages/cozy-authentication/examples/icon.png b/packages/cozy-authentication/examples/icon.png deleted file mode 100644 index a4c3bbfa76..0000000000 Binary files a/packages/cozy-authentication/examples/icon.png and /dev/null differ diff --git a/packages/cozy-authentication/examples/index.html b/packages/cozy-authentication/examples/index.html deleted file mode 100644 index 181662ba35..0000000000 --- a/packages/cozy-authentication/examples/index.html +++ /dev/null @@ -1,2 +0,0 @@ -
- diff --git a/packages/cozy-authentication/examples/index.jsx b/packages/cozy-authentication/examples/index.jsx deleted file mode 100644 index 6b620b9a19..0000000000 --- a/packages/cozy-authentication/examples/index.jsx +++ /dev/null @@ -1,215 +0,0 @@ -import 'babel-polyfill' -import React from 'react' -import ReactDOM from 'react-dom' -import PropTypes from 'prop-types' - -import { Route, hashHistory } from 'react-router' -import 'date-fns/locale/en/index' - -import CozyClient, { CozyProvider, withClient } from 'cozy-client' -import CozyStackClient from 'cozy-stack-client' -import 'cozy-ui/transpiled/react/stylesheet.css' -import IconSprite from 'cozy-ui/transpiled/react/Icon/Sprite' -import { I18n, translate, Button } from 'cozy-ui/transpiled/react' -import { getUniversalLinkDomain } from 'cozy-ui/transpiled/react/AppLinker' - -import { MobileRouter } from '../dist' -import icon from './icon.png' - -const sleep = duration => new Promise(resolve => setTimeout(resolve, duration)) -const client = new CozyClient({ - scope: ['io.cozy.files'], - links: [ - new CozyStackClient(), - { - onLogin: async function () { - await sleep(2000) // So that we can see the logging in view - } - } - ], - oauth: { - clientName: 'Example App', - softwareID: 'io.cozy.example', - redirectURI: 'http://localhost:1234/auth' - } -}) - -const styles = { - error: { - background: 'crimson', - color: 'white', - padding: '1rem' - }, - - wrapper: { - display: 'flex', - flexDirection: 'column', - flexBasis: '100%', - alignItems: 'center', - justifyContent: 'center', - height: '100%' - } -} - -/** Shows basic info on the Cozy to which we are connected */ -class DumbInformations extends React.Component { - constructor(props) { - super(props) - this.state = { infos: null } - } - - componentDidMount() { - this.fetchInformations() - } - - async fetchInformations() { - const { client } = this.props - try { - const infos = await client.stackClient.fetchInformation() - this.setState({ infos }) - } catch (error) { - this.setState({ error }) - } - } - - render() { - const { error, infos } = this.state - if (error) { - return - } - return infos ?
{JSON.stringify(infos, null, 2)} 
:
...
- } -} - -const Informations = withClient(DumbInformations) - -/** After login, show logout and revoke buttons */ -const LoggedIn = translate()( - withClient(({ client, t }) => ( -
- {t('logged-in.title')} -
- URL: {client.stackClient.uri} -
- {t('logged-in.client-id')}: {client.stackClient.oauthOptions.clientID} - -
-
-
- )) -) - -const exampleLocales = { - en: { - 'logged-in': { - title: 'Logged in !', - 'client-id': 'Client ID', - logout: 'Logout', - revoke: 'Revoke' - } - } -} - -const Error = ({ error }) => ( -
An error occured {error.stack}
-) - -/** Catch error and show it */ -class ErrorBoundary extends React.Component { - constructor(props) { - super(props) - this.state = { error: null } - } - - componentDidCatch(error) { - this.setState({ error }) - } - - render() { - return this.state.error ? ( - - ) : ( - this.props.children - ) - } -} - -/** Provides lang passed in props inside context */ -class LocaleContext extends React.Component { - getChildContext() { - return { - lang: this.props.lang - } - } - - render() { - return this.props.children - } -} - -LocaleContext.childContextTypes = { - lang: PropTypes.string -} - -/** Buttons to change language */ -const LangChooser = translate()(({ lang, onChange }) => ( -
- - - locale: {lang} -
-)) - -class App extends React.Component { - constructor(props) { - super(props) - this.handleChangeLocale = this.handleChangeLocale.bind(this) - this.state = { - lang: localStorage.getItem('lang') || navigator.language.substring(0, 2) - } - } - - handleChangeLocale(lang) { - this.setState({ lang }) - localStorage.setItem('lang', lang) - } - - render() { - const { title, icon } = this.props - return ( - - - - exampleLocales[lang]} - lang={this.state.lang} - > - - - - - - - - - - ) - } -} - -ReactDOM.render( - , - document.querySelector('#app') -) diff --git a/packages/cozy-authentication/jest.setup.js b/packages/cozy-authentication/jest.setup.js deleted file mode 100644 index 88c8c3b323..0000000000 --- a/packages/cozy-authentication/jest.setup.js +++ /dev/null @@ -1,4 +0,0 @@ -import Enzyme from 'enzyme' -import Adapter from 'enzyme-adapter-react-16' - -Enzyme.configure({ adapter: new Adapter() }) diff --git a/packages/cozy-authentication/package.json b/packages/cozy-authentication/package.json deleted file mode 100644 index 4a02a394b8..0000000000 --- a/packages/cozy-authentication/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "cozy-authentication", - "version": "3.6.1", - "description": "Component providing login to a Cozy", - "main": "dist/index.js", - "files": [ - "dist" - ], - "author": "Cozy", - "license": "MIT", - "scripts": { - "prepare": "yarn build; yarn copy-files", - "build": "env BABEL_ENV=transpilation yarn babel src/ --out-dir dist", - "prepublishOnly": "yarn build", - "watch": "yarn build -w", - "test": "yarn jest src", - "copy-files": "cp -r src/locales/ dist/locales/", - "lint": "cd ..; yarn eslint --ext js,jsx packages/cozy-authentication", - "example": "nf start", - "example-server": "parcel --port 1234 $(pwd)/examples/index.html" - }, - "devDependencies": { - "@babel/cli": "7.16.8", - "@babel/polyfill": "7.12.1", - "babel-preset-cozy-app": "^2.8.1", - "cozy-client": "13.21.0", - "cozy-ui": "40.9.1", - "cssnano-preset-advanced": "4.0.8", - "date-fns": "1.30.1", - "enzyme": "3.11.0", - "enzyme-adapter-react-16": "1.15.6", - "eslint-cli": "1.1.1", - "foreman": "3.0.1", - "jest": "26.6.3", - "parcel": "1.12.4", - "postcss-merge-rules": "4.0.3", - "react": "16.12.0", - "react-dom": "16.13.0", - "react-router": "6.3.0", - "react-router-dom": "6.4.5" - }, - "dependencies": { - "cozy-device-helper": "^3.7.1", - "localforage": "1.7.3", - "prop-types": "15.7.2", - "snarkdown": "1.2.2", - "url-polyfill": "1.1.7" - }, - "jest": { - "testURL": "http://localhost:8000", - "transformIgnorePatterns": [ - "/node_modules/(?!cozy-ui)" - ], - "testPathIgnorePatterns": [ - "/node_modules/", - "dist" - ], - "modulePaths": [ - "/node_modules/", - "/../../node_modules/" - ], - "setupFiles": [ - "./jest.setup.js" - ], - "moduleNameMapper": { - "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|styl)$": "identity-obj-proxy", - "^cozy-client$": "cozy-client/dist/index.js" - } - }, - "peerDependencies": { - "cozy-client": ">=13.15.1", - "cozy-ui": ">=40.9.1", - "react": ">=15", - "react-router": "3", - "react-router-dom": "^6.4.5" - } -} diff --git a/packages/cozy-authentication/scripts/gen-authorize.sh b/packages/cozy-authentication/scripts/gen-authorize.sh deleted file mode 100755 index 4d85961086..0000000000 --- a/packages/cozy-authentication/scripts/gen-authorize.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -export STATE=mystate -export SECRET=mysecret -export STACK_DOMAIN=cozy.tools:8080 -export REDIRECT_URI=http://localhost:1234/auth -export SCOPE=io.cozy.files -export CLIENT_ID=$(cozy-stack instances client-oauth $STACK_DOMAIN "$REDIRECT_URI" example-app io.cozy.example --onboarding-app example --onboarding-permissions $SCOPE --onboarding-secret $SECRET --onboarding-state $STATE) - -echo "http://cozy.tools:8080/auth/authorize?state=$STATE&client_id=$CLIENT_ID&secret=$SECRET&response_type=code&scope=$SCOPE&redirect_uri=$REDIRECT_URI" diff --git a/packages/cozy-authentication/scripts/get-translations.sh b/packages/cozy-authentication/scripts/get-translations.sh deleted file mode 100755 index 99ff448ef3..0000000000 --- a/packages/cozy-authentication/scripts/get-translations.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -set -euxo pipefail - -DRIVE_DIR=$1 -JQ_REQ='{ onboarding: .mobile.onboarding } + { revoked: .mobile.revoked } | { mobile: . }' - -cat $DRIVE_DIR/locales/en.json | jq "$JQ_REQ" > src/locales/en.json -cat $DRIVE_DIR/locales/fr.json | jq "$JQ_REQ" > src/locales/fr.json diff --git a/packages/cozy-authentication/src/Authentication.jsx b/packages/cozy-authentication/src/Authentication.jsx deleted file mode 100644 index 2bfe1ff4e0..0000000000 --- a/packages/cozy-authentication/src/Authentication.jsx +++ /dev/null @@ -1,120 +0,0 @@ -import React, { Component } from 'react' -import PropTypes from 'prop-types' -import Welcome from './steps/Welcome' -import SelectServer from './steps/SelectServer' -import { withClient } from 'cozy-client' -import withLocales from './withLocales' -import { registerAndLogin } from './utils/onboarding' - -const STEP_WELCOME = 'STEP_WELCOME' -const STEP_EXISTING_SERVER = 'STEP_EXISTING_SERVER' - -class Authentication extends Component { - constructor(props) { - super(props) - - this.state = { - currentStepIndex: 0, - generalError: null, - fetching: false - } - - this.steps = [STEP_WELCOME] - this.connectToServer = this.connectToServer.bind(this) - } - - componentWillUnmount() { - this.unmounted = true - } - - nextStep() { - this.setState(prevState => ({ - currentStepIndex: ++prevState.currentStepIndex - })) - } - - onAbort() { - this.setState({ currentStepIndex: 0 }) - } - - setupSteps() { - this.steps = [STEP_WELCOME, STEP_EXISTING_SERVER] - this.nextStep() - } - - async connectToServer(url) { - const { onComplete, onException } = this.props - try { - this.setState({ generalError: null, fetching: true }) - const { client } = this.props - await registerAndLogin(client, url) - await onComplete() - } catch (err) { - this.setState({ generalError: err }) - onException(err, { - tentativeUrl: url, - onboardingStep: 'connecting to server' - }) - } finally { - if (!this.unmounted) { - this.setState({ fetching: false }) - } - } - } - - render() { - const { onException, appIcon, appTitle } = this.props - const { currentStepIndex, generalError, fetching } = this.state - const { Welcome, SelectServer } = this.props.components - - const currentStep = this.steps[currentStepIndex] - - switch (currentStep) { - case STEP_WELCOME: - return ( - this.setupSteps()} - register={() => this.setupSteps()} - allowRegistration={false} - appIcon={appIcon} - appTitle={appTitle} - /> - ) - case STEP_EXISTING_SERVER: - return ( - this.onAbort()} - externalError={generalError} - fetching={fetching} - onException={onException} - /> - ) - default: - return null - } - } -} - -Authentication.propTypes = { - onComplete: PropTypes.func.isRequired, - onException: PropTypes.func.isRequired, - router: PropTypes.object, - appIcon: PropTypes.string.isRequired, - client: PropTypes.object.isRequired -} - -Authentication.contextTypes = { - client: PropTypes.object -} - -Authentication.defaultProps = { - components: { - Welcome, - SelectServer - } -} - -export const DumbAuthentication = Authentication - -export default withLocales(withClient(Authentication)) diff --git a/packages/cozy-authentication/src/Authentication.spec.jsx b/packages/cozy-authentication/src/Authentication.spec.jsx deleted file mode 100644 index 5b2a2afc87..0000000000 --- a/packages/cozy-authentication/src/Authentication.spec.jsx +++ /dev/null @@ -1,53 +0,0 @@ -import { DumbAuthentication } from './Authentication' -import React from 'react' -import { shallow } from 'enzyme' -import CozyClient from 'cozy-client' - -describe('Authentication', () => { - let root, client, instance, onComplete, onException - - const setup = () => { - client = new CozyClient({ oauth: {} }) - jest - .spyOn(client, 'register') - .mockImplementation(() => Promise.resolve({ token: '{}' })) - jest.spyOn(client.stackClient, 'unregister').mockImplementation(() => {}) - onComplete = jest.fn() - onException = jest.fn() - root = shallow( - - ) - instance = root.instance() - } - - it('should connect to server with cozy-client', async () => { - setup() - await instance.connectToServer('pbrowne.mycozy.cloud') - expect(client.register).toHaveBeenCalledWith('pbrowne.mycozy.cloud') - expect(onException).not.toHaveBeenCalled() - expect(onComplete).toHaveBeenCalled() - }) - - it('should call on exception if there is a problem', async () => { - setup() - client.register.mockImplementation(() => { - throw new Error('No internet...') - }) - await instance.connectToServer('pbrowne.mycozy.cloud') - expect(onException).toHaveBeenCalled() - }) - - it('should unregister the client in case of a problem', async () => { - setup() - client.register.mockImplementation(() => { - throw new Error('No internet...') - }) - await instance.connectToServer('pbrowne.mycozy.cloud') - expect(client.stackClient.unregister).toHaveBeenCalled() - }) -}) diff --git a/packages/cozy-authentication/src/MobileRouter.jsx b/packages/cozy-authentication/src/MobileRouter.jsx deleted file mode 100644 index 516b4e442a..0000000000 --- a/packages/cozy-authentication/src/MobileRouter.jsx +++ /dev/null @@ -1,412 +0,0 @@ -import React, { Component } from 'react' -import { Router } from 'react-router' -import { HashRouter, useLocation, useNavigate } from 'react-router-dom' -import PropTypes from 'prop-types' -import { withClient } from 'cozy-client' - -import Authentication from './Authentication' -import Revoked from './Revoked' -import * as onboarding from './utils/onboarding' -import Modal from 'cozy-ui/transpiled/react/Modal' -import Spinner from 'cozy-ui/transpiled/react/Spinner' - -import deeplink from './utils/deeplink' -import credentials from './utils/credentials' - -// Even if the component is not yet mounted, we save -// the deeplink -window.handleOpenURL = deeplink.save - -const clientUpdateEvents = ['login', 'logout', 'revoked', 'unrevoked'] - -export const LoggingInViaOnboarding = () => null - -const centeredFullscreen = { - justifyContent: 'center', - height: '100%', - alignItems: 'center', - display: 'flex', - flexDirection: 'column' -} - -export const LoginInComponent = () => { - return ( - -
- -
-
- ) -} - -export class MobileRouter extends Component { - constructor(props) { - super(props) - this.update = this.update.bind(this) - this.handleDeepLink = this.handleDeepLink.bind(this) - this.handleUniversalLink = this.handleUniversalLink.bind(this) - this.handleLogBackIn = this.handleLogBackIn.bind(this) - this.afterAuthentication = this.afterAuthentication.bind(this) - - this.afterLogout = this.afterLogout.bind(this) - this.handleBeforeLogin = this.handleBeforeLogin.bind(this) - this.handleBeforeLogout = this.handleBeforeLogout.bind(this) - this.handleRequestLogout = this.handleRequestLogout.bind(this) - - this.state = { - isLoggingInViaOnboarding: false, - triedToReconnect: props.initialTriedToReconnect || false - } - } - - componentDidMount() { - this.startListeningToClient() - this.startHandlingDeeplinks() - this.startListeningToUniversalLinks() - this.tryToReconnect() - } - - async tryToReconnect() { - const client = this.props.client - const saved = await credentials.get() - try { - if (saved && saved.oauthOptions) { - client.stackClient.setOAuthOptions(saved.oauthOptions) - await client.login({ - uri: saved.uri, - token: saved.token - }) - } - } finally { - this.setState({ triedToReconnect: true }) - } - } - - startListeningToClient() { - const { client } = this.props - for (let ev of clientUpdateEvents) { - client.on(ev, this.update) - } - client.on('beforeLogin', this.handleBeforeLogin) - client.on('login', this.afterAuthentication) - client.on('beforeLogout', this.handleBeforeLogout) - client.on('logout', this.afterLogout) - } - - stopListeningToClient() { - const { client } = this.props - for (let ev of clientUpdateEvents) { - client.removeListener(ev, this.update) - } - client.removeListener('beforeLogin', this.handleBeforeLogin) - client.removeListener('login', this.afterAuthentication) - client.removeListener('beforeLogout', this.handleBeforeLogout) - client.removeListener('logout', this.afterLogout) - } - - startListeningToUniversalLinks() { - if (window.universalLinks) { - window.universalLinks.subscribe( - 'openUniversalLink', - this.handleUniversalLink - ) - } - } - - componentWillUnmount() { - this.stopHandlingDeeplinks() - this.stopListeningToClient() - this.stopListeningToUniversalLinks() - this.unmounted = true - } - - update() { - this.forceUpdate() - } - - handleUniversalLink(eventData) { - /* - @TODO: openUniversalLink seems to be called only on iOS. - android uses handleOpenURL by default ?! - */ - this.handleDeepLink(eventData.url) - if (window.handleOpenURL !== this.handleDeepLink) { - // This means that someone else is handling open url, must - // be cozy-client that replaced the function during the - // normal register. We have to call the function in its place - // See cozy-client/src/authentication/mobile - // - // The handler of open url has the responsibility to replace - // window.handleOpenURL back with our handler (which cozy-client - // rightfully does). - window.handleOpenURL(eventData.url) - } - } - - startHandlingDeeplinks() { - // While this component is mounted, it handles deep links - this.originalHandleOpenURL = window.handleOpenURL - window.handleOpenURL = this.handleDeepLink - // If a deep link was opened when this component was not yet mounted - const link = deeplink.get() - if (link) { - this.handleDeepLink(link) - } - } - - stopHandlingDeeplinks() { - window.handleOpenURL = this.originalHandleOpenURL - } - - stopListeningToUniversalLinks() { - if (window.universalLinks) { - window.universalLinks.unsubscribe('openUniversalLink') - } - } - - handleDeepLink(urlArg) { - const { protocol, appSlug, universalLinkDomain } = this.props - const url = urlArg || deeplink.get() - deeplink.clear() - if (!url) { - return - } - const appInfos = { - protocol, - appSlug, - universalLinkDomain - } - const path = deeplink.generateRoute(url, appInfos) - this.props.history.replace('/' + path) - if (path.startsWith('auth')) { - this.handleAuth() - } - } - - async handleAuth() { - const { client, history } = this.props - try { - const currentLocation = history.getCurrentLocation() - const { access_code, state, cozy_url, code } = currentLocation.query - if (!code || !cozy_url) { - // Here it means that were are not in an onboarding login, we are - // in a normal login, the register() called in Authentication::selectServer - // should have completed - return - } - - // on iOS, hide() the ViewController since it is still active - // when the application comes from background - if (window.SafariViewController) window.SafariViewController.hide() - this.setState({ isLoggingInViaOnboarding: true }) - await onboarding.doOnboardingLogin(client, cozy_url, state, access_code) - this.afterAuthentication() - } catch (error) { - // eslint-disable-next-line no-console - console.error('Error while trying to automatically login', error) - await client.logout() - } finally { - if (!this.unmounted) { - this.setState({ isLoggingInViaOnboarding: false }) - } - } - } - - render() { - const { - appIcon, - appTitle, - appRoutes, - onException, - client, - LoginInComponent, - children, - // TODO LogoutComponent should come from props.components and have - // a default - LogoutComponent - } = this.props - - const { Authentication, Revoked } = this.props.components - const { - isLoggingInViaOnboarding, - isLoggingIn, - isLoggingOut, - triedToReconnect - } = this.state - - if (!triedToReconnect) { - return null - } - - if (isLoggingIn) { - return - } - - if (LogoutComponent && isLoggingOut) { - return - } - - if (isLoggingInViaOnboarding) { - return - } - - if (!client.isLogged) { - return ( - - ) - } else if (client.isRevoked) { - return ( - - ) - } else { - return <>{appRoutes || children} - } - } - - async handleLogBackIn() { - const { client } = this.props - await client.stackClient.unregister().catch(() => {}) - await onboarding.registerAndLogin(client, client.stackClient.uri) - } - - handleBeforeLogin() { - this.setState({ isLoggingIn: true }) - } - - async afterAuthentication() { - if (this.props.onAuthenticated) { - await this.props.onAuthenticated({ history: this.props.history }) - } - - await credentials.saveFromClient(this.props.client) - // We need to set the state after all the previous actions - // since we can have async task in `onAuthenticated`. Setting - // isLoggingIn to true before result in displaying `appRoutes` - // too soon in this case - this.setState({ isLoggingIn: false }) - } - - handleBeforeLogout() { - this.setState({ isLoggingOut: true }) - } - - async afterLogout() { - this.setState({ isLoggingOut: false }) - this.props.history.replace(this.props.logoutPath) - await credentials.clear() - if (this.props.onLogout) { - this.props.onLogout({ history: this.props.history }) - } - } - - async handleRequestLogout() { - const { client } = this.props - await client.logout() - } -} - -MobileRouter.defaultProps = { - onException: e => { - console.error('Exception', e) // eslint-disable-line no-console - }, - - logoutPath: '/', - - components: { - Authentication, - Revoked - }, - - LoginInComponent -} - -MobileRouter.propTypes = { - history: PropTypes.object, - - appRoutes: PropTypes.node, - children: PropTypes.node, - appTitle: PropTypes.string.isRequired, - appIcon: PropTypes.string.isRequired, - appSlug: PropTypes.string.isRequired, - - universalLinkDomain: PropTypes.string.isRequired, - - onAuthenticated: PropTypes.func, - onLogout: PropTypes.func, - onException: PropTypes.func.isRequired, - - /** CozyClient instance, should be provided via */ - client: PropTypes.object.isRequired, - - /** After logout, where do we go */ - logoutPath: PropTypes.string, - - /** LoginInComponent is displayed while the client is logging out */ - LoginInComponent: PropTypes.elementType, - - /** LogoutComponent is displayed while the client is logging out */ - LogoutComponent: PropTypes.elementType, - - /** Used to set internal state property `triedToReconnect` on instantation. - * Is used by tests. - */ - initialTriedToReconnect: PropTypes.bool -} - -const MobileRouterV3 = ({ children, history, ...props }) => { - return ( - - {children} - - ) -} - -const MobileRouterDomV6 = ({ children, ...props }) => { - const location = useLocation() - const navigate = useNavigate() - const history = { - replace: path => { - navigate(path, { replace: true }) - }, - getCurrentLocation: () => { - return location - } - } - return ( - - {children} - - ) -} - -const MobileRouterWrapper = ({ children, history, ...props }) => { - if (history) { - // react-router@3 - return ( - - - {children} - - - ) - } else { - // react-router-dom@6 - return ( - - {children} - - ) - } -} - -export const DumbMobileRouter = MobileRouter - -export default withClient(MobileRouterWrapper) diff --git a/packages/cozy-authentication/src/MobileRouter.spec.jsx b/packages/cozy-authentication/src/MobileRouter.spec.jsx deleted file mode 100644 index e67ab38913..0000000000 --- a/packages/cozy-authentication/src/MobileRouter.spec.jsx +++ /dev/null @@ -1,262 +0,0 @@ -import React from 'react' -import { mount } from 'enzyme' - -import CozyClient, { CozyProvider } from 'cozy-client' -import { I18n } from 'cozy-ui/transpiled/react/I18n' - -import Authentication from './Authentication' -import MobileRouter, { - DumbMobileRouter, - LoggingInViaOnboarding, - LoginInComponent -} from './MobileRouter' -import Revoked from './Revoked' -import * as onboarding from './utils/onboarding' - -jest.mock('react-router', () => ({ - Router: props => props.children -})) - -const AppRoutes = () =>
-const LoggingOut = () =>
Logging out...
- -describe('MobileRouter', () => { - let appRoutes, - onAuthenticated, - onLogout, - history, - appIcon, - appTitle, - appSlug, - app, - client, - currentLocation, - props, - LogoutComponent, - universalLinkDomain - - beforeEach(() => { - appRoutes = - onAuthenticated = jest.fn() - onLogout = jest.fn() - history = { - replace: jest.fn(), - getCurrentLocation: jest.fn(() => currentLocation) - } - appIcon = 'icon.png' - appTitle = 'Test App' - appSlug = 'test' - universalLinkDomain = 'https://ul.mycozy.cloud' - app = null - client = new CozyClient({}) - props = { - appRoutes, - onAuthenticated, - onLogout, - history, - appIcon, - appTitle, - appSlug, - universalLinkDomain - } - LogoutComponent = null - }) - - afterEach(() => { - jest.clearAllMocks() - }) - - const setup = () => { - app = mount( - - x} lang="en" dictRequire={() => ({})}> - - - - ) - } - - it('should listen to the client', () => { - setup() - const instance = app.find(DumbMobileRouter).instance() - jest.spyOn(instance, 'forceUpdate') - client.emit('login') - expect(instance.forceUpdate).toHaveBeenCalled() - }) - - it('should call onAuthenticated prop if defined', () => { - setup() - client.emit('login') - expect(onAuthenticated).toHaveBeenCalled() - }) - - it('should go to logoutPath after logout', () => { - setup() - client.emit('logout') - expect(history.replace).toHaveBeenCalledWith('/afterLogout') - }) - - it('should render the auth screen when client is not logged', () => { - client.isLogged = false - setup() - expect(app.find(Authentication).length).toBe(1) - }) - - it('should render the revoked view when logged and revoked', () => { - client.isLogged = true - client.isRevoked = true - setup() - expect(app.find(Revoked).length).toBe(1) - }) - - it('should render the appRoutes when client is logged, not revoked, and not onboarding', () => { - client.isLogged = true - setup() - expect(app.find(AppRoutes).length).toBe(1) - }) - - describe('universal link', () => { - it('should call handleDeepLink with the url from the event', () => { - setup() - const instance = app.find(DumbMobileRouter).instance() - jest.spyOn(instance, 'handleDeepLink') - instance.handleUniversalLink({ url: 'http://fake.url.com' }) - expect(instance.handleDeepLink).toHaveBeenCalledWith( - 'http://fake.url.com' - ) - }) - - it('should not call window.handleOpenURL if it has not been touched by something else', () => { - // Here window.handleOpenURL will be replaced by the handler from MobileRouter - // We have to use handler since window.handleOpenURL is replaced by something that - // is not a spy by MobileRouter - const handler = jest.fn() - window.handleOpenURL = handler - setup() - const instance = app.find(DumbMobileRouter).instance() - instance.handleUniversalLink({ url: 'http://fake.url.com' }) - expect(handler).not.toHaveBeenCalled() - }) - - it('should call window.handleOpenURL if it has been touched by something else', () => { - setup() - const instance = app.find(DumbMobileRouter).instance() - jest.spyOn(instance, 'handleDeepLink') - // Here window.handleOpenURL is replaced during the life of MobileRouter; it must be - // important. It should be called. - window.handleOpenURL = jest.fn() - instance.handleUniversalLink({ url: 'http://fake.url.com' }) - expect(window.handleOpenURL).toHaveBeenCalledWith('http://fake.url.com') - }) - }) - - describe('Logging in', () => { - it('should show LogInComponent during login', async () => { - LogoutComponent = LoggingOut - setup() - client.emit('beforeLogin') - app.update() - expect(app.find(LoginInComponent).length).toBe(1) - // We don't emit('login') since we need to wait the end of - // `afterAuthentication` now to check if the login component is - // here or not. So we call afterAuth manually - const mobileRouter = app.find(DumbMobileRouter).instance() - - await mobileRouter.afterAuthentication() - app.update() - expect(app.find(LoginInComponent).length).toBe(0) - }) - }) - - describe('Logging out', () => { - it('should not error if LogoutComponent not available', () => { - setup() - client.emit('beforeLogout') - app.update() - client.emit('logout') - app.update() - expect(true).toBe(true) - }) - - it('should show LogoutComponent during logout', () => { - LogoutComponent = LoggingOut - setup() - client.emit('beforeLogout') - app.update() - expect(app.find(LoggingOut).length).toBe(1) - client.emit('logout') - app.update() - expect(app.find(LoggingOut).length).toBe(0) - }) - }) - - describe('Auto Onboarding', () => { - let query - - beforeEach(() => { - query = { - access_code: 'accessCode', - state: 'state-123', - cozy_url: 'pbrowne.mycozy.cloud', - code: 'code-that-is-only-in-onboarding' - } - }) - - it('should render a special view when logging in via onboarding has started', async () => { - setup() - currentLocation = { - query - } - const mobileRouter = app.find(DumbMobileRouter).instance() - jest - .spyOn(onboarding, 'doOnboardingLogin') - .mockImplementation(async () => { - // Necessary to call update() since setState is called asynchronously - // https://github.com/airbnb/enzyme/issues/450 - app.update() - expect(app.find(LoggingInViaOnboarding).length).toBe(1) - }) - await mobileRouter.handleAuth() - app.update() - expect(onboarding.doOnboardingLogin).toHaveBeenCalled() - expect(app.find(LoggingInViaOnboarding).length).toBe(0) - }) - - it('should call client.logout if doOnboarding fails', async () => { - setup() - const mobileRouter = app.find(DumbMobileRouter).instance() - jest.spyOn(onboarding, 'doOnboardingLogin').mockRejectedValue({}) - jest.spyOn(client, 'logout') - jest.spyOn(console, 'warn').mockImplementation(() => {}) - jest.spyOn(console, 'error').mockImplementation(() => {}) - await mobileRouter.handleAuth() - expect(client.logout).toHaveBeenCalled() - }) - - for (const requiredOnboardingArg of ['cozy_url', 'code']) { - it(`should not do an onboarding login if ${requiredOnboardingArg} is not in the URL`, async () => { - delete query[requiredOnboardingArg] - setup() - currentLocation = { - query - } - const mobileRouter = app.find(DumbMobileRouter).instance() - jest - .spyOn(onboarding, 'doOnboardingLogin') - .mockImplementation(async () => { - // Necessary to call update() since setState is called asynchronously - // https://github.com/airbnb/enzyme/issues/450 - app.update() - expect(app.find(LoggingInViaOnboarding).length).toBe(1) - }) - await mobileRouter.handleAuth() - expect(onboarding.doOnboardingLogin).not.toHaveBeenCalled() - }) - } - }) -}) diff --git a/packages/cozy-authentication/src/Revoked.jsx b/packages/cozy-authentication/src/Revoked.jsx deleted file mode 100644 index c48bcd5061..0000000000 --- a/packages/cozy-authentication/src/Revoked.jsx +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react' -import PropTypes from 'prop-types' -import Modal from 'cozy-ui/transpiled/react/Modal' -import { translate } from 'cozy-ui/transpiled/react/I18n' -import { withClient } from 'cozy-client' -import withLocales from './withLocales' - -const Revoked = ({ t, onLogBackIn, onLogout }) => ( - -) - -Revoked.propTypes = { - onLogout: PropTypes.func.isRequired, - onLogBackIn: PropTypes.func.isRequired -} - -export default withLocales(withClient(translate()(Revoked))) diff --git a/packages/cozy-authentication/src/index.js b/packages/cozy-authentication/src/index.js deleted file mode 100644 index 8054c35b5b..0000000000 --- a/packages/cozy-authentication/src/index.js +++ /dev/null @@ -1,7 +0,0 @@ -export { default as MobileRouter } from './MobileRouter' - -import Authentication from './Authentication' -import Revoked from './Revoked' - -export { Authentication } -export { Revoked } diff --git a/packages/cozy-authentication/src/locales/en.json b/packages/cozy-authentication/src/locales/en.json deleted file mode 100644 index 8d16bdb642..0000000000 --- a/packages/cozy-authentication/src/locales/en.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "mobile": { - "onboarding": { - "welcome": { - "title": "%{appTitle}", - "desc": "Create a Cozy or sign in to access %{appTitle}.", - "button": "Sign in to your cozy", - "no_account_link": "No Cozy? Ask for one here.", - "create_my_cozy": "Create my Cozy" - }, - "server_selection": { - "title": "Sign in", - "lostpwd": "[I forgot the address of my Cozy](https://manager.cozycloud.cc/cozy/reminder)", - "label": "Address of my Cozy", - "cozy_address_placeholder": "claude", - "cozy_custom_address_placeholder": "claude.mydomain.com", - "domain_cozy": ".mycozy.cloud", - "domain_custom": "other", - "button": "Next", - "previous": "Previous", - "wrong_address_with_email": "You typed an email address. To connect on your cozy you must type its url, something like https://claude.mycozy.cloud", - "wrong_address_v2": "You have just entered the address of old Cozy version. This application is only compatible with the latest version. Please contact support for more information.", - "wrong_address": "This address doesn’t seem to be a cozy. Please check the address you provide.", - "wrong_address_cosy": "Woops, the address is not correct. Try with \"cozy\" with a \"z\"!" - }, - "files": { - "title": "Access your drive", - "description": "In order to save your Cozy Drive on your device, the application must access your files." - }, - "photos": { - "title": "Backup your photos and videos", - "description": "Automatically backup the photos taken with your phone to your Cozy, so you never lose them." - }, - "contacts": { - "title": "Sync your contacts", - "description": "Save your phone's contact on your Cozy — this will facilitate sharing files with them." - }, - "step": { - "button": "Enable now", - "skip": "Later", - "next": "Next" - }, - "analytics": { - "title": "Help us improve Cozy", - "description": "The application will automatically provide data (mainly errors) to Cozy Cloud. It will allow us to resolve problems faster." - } - }, - "revoked": { - "title": "Access revoked", - "description": "It appears you revoked this device from your Cozy. If you didn't, please let us know at contact@cozycloud.cc. All your local data related to your Cozy will be removed.", - "loginagain": "Log in again", - "logout": "Log out" - }, - "settings": { - "media_backup": { - "media_folder": "Photos", - "backup_folder": "Backed up from my mobile", - "legacy_backup_folder": "Backuped from my mobile", - "title": "Media Backup" - } - } - } -} diff --git a/packages/cozy-authentication/src/locales/fr.json b/packages/cozy-authentication/src/locales/fr.json deleted file mode 100644 index 01bc4a1d7d..0000000000 --- a/packages/cozy-authentication/src/locales/fr.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "mobile": { - "onboarding": { - "welcome": { - "title1": "Bienvenue sur Cozy", - "title2": "Votre propre cloud personnel", - "desc": "Créer un Cozy ou connectez vous pour accéder à %{appTitle}.", - "button": "Vous connecter à votre Cozy", - "no_account_link": "Vous n'avez pas de compte ? Demandez-en un ici.", - "create_my_cozy": "Créer mon Cozy" - }, - "server_selection": { - "title": "Vous connecter à votre Cozy", - "lostpwd": "[J'ai oublié l'adresse de mon Cozy](https://manager.cozycloud.cc/cozy/reminder)", - "description": "Exemple: https://**claude**.mycozy.cloud\n", - "label": "Entrez l'adresse de votre Cozy", - "cozy_address_placeholder": "claude", - "cozy_custom_address_placeholder": "claude.mycozy.cloud", - "domain_custom": "autre", - "button": "Suivant", - "previous": "Précédent", - "wrong_address_with_email": "Vous avez entré une adresse email. Pour vous connecter à votre Cozy vous devez entrer son url, sous la forme https://claude.mycozy.cloud", - "wrong_address_v2": "Vous avez entré l'adresse d'une Cozy v2. Cette application n'est compatible qu'avec la dernière version de Cozy. Contactez notre assistance pour plus d'informations", - "wrong_address": "Cette adresse ne semble pas correspondre à un Cozy.", - "wrong_address_cosy": "Oups, ce n'est pas la bonne adresse. Essayez d'écrire \"cozy\" avec un \"z\" !" - }, - "files": { - "title": "Accéder à vos fichiers", - "description": "Pour sauvegarder les fichiers de votre Cozy sur votre périphérique, l'application doit accéder à vos fichiers." - }, - "photos": { - "title": "Sauvegarder vos photos et vos vidéos", - "description": "Sauvegarder automatiquement les photos prises avec votre téléphone dans votre Cozy, pour ne jamais les perdre." - }, - "contacts": { - "title": "Synchronisez vos contacts", - "description": "Sauvegardez les contacts de votre appareil sur votre Cozy — cela facilitera le partage de fichiers avec eux." - }, - "step": { - "button": "Activer maintenant", - "skip": "Plus tard", - "next": "Suivant" - }, - "analytics": { - "title": "Aidez-nous à améliorer Cozy", - "description": "Cette application transmettra automatiquement des données (surtout des erreurs) à notre équipe support. Cela nous permettra de résoudre les problèmes plus vite." - } - }, - "revoked": { - "title": "Accès révoqué", - "description": "Vous semblez avoir révoqué votre périphérique depuis votre Cozy. Si ce n'est pas vous, n'hésitez pas à nous contacter à contact@cozycloud.cc. Toutes les données relatives à Cozy présentes localement vont être supprimées.", - "loginagain": "Se réenregistrer", - "logout": "Se déconnecter" - }, - "settings": { - "media_backup": { - "media_folder": "Photos", - "backup_folder": "Sauvegardées depuis mon mobile", - "legacy_backup_folder": "Sauvegardées depuis mon mobile", - "title": "Sauvegarder des médias" - } - } - } -} diff --git a/packages/cozy-authentication/src/steps/ButtonLinkRegistration.jsx b/packages/cozy-authentication/src/steps/ButtonLinkRegistration.jsx deleted file mode 100644 index 86ce514140..0000000000 --- a/packages/cozy-authentication/src/steps/ButtonLinkRegistration.jsx +++ /dev/null @@ -1,65 +0,0 @@ -import React, { Component } from 'react' -import PropTypes from 'prop-types' - -import { nativeLinkOpen } from 'cozy-device-helper' -import Button from 'cozy-ui/transpiled/react/Button' -import { withClient } from 'cozy-client' - -import { generateOnboardingQueryPart } from '../utils/onboarding' - -const MANAGER_URL = 'https://manager.cozycloud.cc/cozy/create' - -export class ButtonLinkRegistration extends Component { - constructor(props) { - super(props) - this.handleClick = this.handleClick.bind(this) - } - - state = { - url: '' - } - async generateUrl() { - const oauthOptions = await generateOnboardingQueryPart( - this.props.client.options.oauth - ) - const url = `${MANAGER_URL}?onboarding=${oauthOptions}` - this.setState({ url }) - return url - } - - async handleClick() { - const generatedUrl = await this.generateUrl() - return nativeLinkOpen({ url: generatedUrl }) - } - - render() { - const { - className = '', - label, - size, - subtle = false, - type = 'submit', - theme = 'primary' - } = this.props - const { url } = this.state - return ( -