-
Notifications
You must be signed in to change notification settings - Fork 65
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 #664 from cozy/auth-component-npm
Auth component published on npm
- Loading branch information
Showing
18 changed files
with
7,220 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/** | ||
src/authentication/node_modules/** | ||
src/authentication/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
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,55 @@ | ||
[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] 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 Freenode][freenode] | ||
- 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" | ||
[setup]: https://dev.cozy.io/#set-up-the-development-environment "Cozy dev docs: Set up the Development Environment" | ||
[doctypes]: https://dev.cozy.io/#main-document-types | ||
[bill-doctype]: https://github.com/cozy-labs/konnectors/blob/master/server/models/bill.coffee | ||
[konnector-doctype]: https://github.com/cozy-labs/konnectors/blob/master/server/models/konnector.coffee | ||
[konnectors]: https://github.com/cozy-labs/konnectors | ||
[MIT]: https://opensource.org/licenses/MIT | ||
[contribute]: CONTRIBUTING.md | ||
[freenode]: http://webchat.freenode.net/?randomnick=1&channels=%23cozycloud&uio=d4 | ||
[forum]: https://forum.cozy.io/ | ||
[github]: https://github.com/cozy/ | ||
[twitter]: https://twitter.com/mycozycloud | ||
[mocha]: https://mochajs.org/ | ||
[should]: npmjs.com/package/should | ||
[checkbox]: https://help.github.com/articles/basic-writing-and-formatting-syntax/#task-lists |
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,32 @@ | ||
import React from 'react' | ||
import { I18n } from 'cozy-ui/react' | ||
import Authentication from './Authentication' | ||
import Revoked from './Revoked' | ||
import PropTypes from 'prop-types' | ||
|
||
const withLocales = Wrapped => { | ||
const Wrapper = (props, context) => { | ||
const { lang } = context | ||
// We pluck a subset of the locales not to ship all Drive locales | ||
// when we distribute our component | ||
const locales = require(`!!./json-pluck-loader?key=mobile.onboarding;mobile.revoked!drive/locales/${lang}.json`) | ||
return ( | ||
// Wrap into its own I18n to provide its own locales | ||
<I18n dictRequire={() => locales} lang={lang}> | ||
<Wrapped {...props} /> | ||
</I18n> | ||
) | ||
} | ||
|
||
Wrapper.contextTypes = { | ||
lang: PropTypes.string.isRequired | ||
} | ||
|
||
return Wrapper | ||
} | ||
|
||
const StandaloneAuthentication = withLocales(Authentication) | ||
const StandaloneRevoked = withLocales(Revoked) | ||
|
||
export { StandaloneAuthentication as Authentication } | ||
export { StandaloneRevoked as Revoked } |
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 @@ | ||
/** | ||
* Plucks a JSON | ||
* | ||
* en.json | ||
* | ||
* ``` | ||
* { | ||
* a: 1, | ||
* b: { | ||
* c: { | ||
* d: 4 | ||
* }, | ||
* e: 5 | ||
* } | ||
* } | ||
* ``` | ||
* | ||
* `json-pluck-loader?key=b.c!en.json` result will be : | ||
* | ||
* ```{ b: { c: { d: 4 }}}``` | ||
* | ||
* `json-pluck-loader?key=a!en.json` result will be : | ||
* | ||
* ```{ a: 1}``` | ||
* | ||
*/ | ||
|
||
const { getOptions } = require('loader-utils') | ||
|
||
module.exports = function loader(source) { | ||
const options = getOptions(this) | ||
const res = {} | ||
const all = JSON.parse(source) | ||
|
||
const paths = options.key.split(';') | ||
for (let i = 0; i < paths.length; i++) { | ||
const path = paths[i].split('.') | ||
const l = path.length | ||
let leaf = all | ||
let curRes = res | ||
for (var j = 0; j < l; j++) { | ||
const token = path[j] | ||
leaf = leaf[token] | ||
curRes[token] = j === l - 1 ? leaf : curRes[token] || {} | ||
curRes = curRes[token] | ||
} | ||
} | ||
|
||
return `module.exports = ${JSON.stringify(res)}` | ||
} |
Oops, something went wrong.