1 | # LSK.js – auth
|
2 |
|
3 | > @lskjs/auth – LSK.js – auth – module for authorization by login and password and singup through social networks
|
4 |
|
5 | [![LSK logo](https://badgen.net/badge/icon/MADE%20BY%20LSK?icon=zeit\&label\&color=red\&labelColor=red)](https://github.com/lskjs)
|
6 | [![NPM version](https://badgen.net/npm/v/@lskjs/auth)](https://www.npmjs.com/package/@lskjs/auth)
|
7 | [![NPM downloads](https://badgen.net/npm/dt/@lskjs/auth)](https://www.npmjs.com/package/@lskjs/auth)
|
8 | [![NPM Dependency count](https://badgen.net/bundlephobia/dependency-count/@lskjs/auth)](https://bundlephobia.com/result?p=@lskjs/auth)
|
9 | [![Have TypeScript types](https://badgen.net/npm/types/@lskjs/auth)](https://www.npmjs.com/package/@lskjs/auth)
|
10 | [![Have tree shaking](https://badgen.net/bundlephobia/tree-shaking/@lskjs/auth)](https://bundlephobia.com/result?p=@lskjs/auth)
|
11 | [![NPM Package size](https://badgen.net/bundlephobia/minzip/@lskjs/auth)](https://bundlephobia.com/result?p=@lskjs/auth)
|
12 | [![Package size](https://badgen.net//github/license/lskjs/lskjs)](https://github.com/lskjs/lskjs/blob/master/LICENSE)
|
13 | [![Ask us in Telegram](https://img.shields.io/badge/Ask%20us%20in-Telegram-brightblue.svg)](https://t.me/lskjschat)
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | ***
|
20 |
|
21 |
|
22 |
|
23 | # Table of contents
|
24 |
|
25 | * [⌨️ Install](#️-install)
|
26 | * [достал из chat.server.js](#достал-из-chatserverjs)
|
27 | * [📖 License](#-license)
|
28 | * [👥 Contributors](#-contributors)
|
29 | * [👏 Contributing](#-contributing)
|
30 | * [📮 Any questions? Always welcome :)](#-any-questions-always-welcome-)
|
31 |
|
32 | # ⌨️ Install
|
33 |
|
34 | ```sh
|
35 | # yarn
|
36 | yarn i @lskjs/auth @lskjs/db @lskjs/mobx @lskjs/server-api axios bluebird js-cookie lodash mobx
|
37 |
|
38 | # npm
|
39 | npm i @lskjs/auth @lskjs/db @lskjs/mobx @lskjs/server-api axios bluebird js-cookie lodash mobx
|
40 | ```
|
41 |
|
42 | ***
|
43 |
|
44 | # достал из chat.server.js
|
45 |
|
46 | ```js
|
47 | Message.getRole(userId) -> owner
|
48 | Message.is('owner') // ?
|
49 | Message.roles = {
|
50 | owner: {
|
51 | read: ['title', 'createdAt'], // all
|
52 | write: ['user, 'owner'] // info
|
53 | }
|
54 | guest: {
|
55 | read: ['title', 'createdAt'], // all
|
56 | write: ['user, 'owner'] // null
|
57 | }
|
58 | validate params
|
59 | 1) OWNER
|
60 | 2) Public
|
61 |
|
62 |
|
63 | Message.isOwner = (userId) => { this.ownerId } ['content']
|
64 | Message.canWrite = ['content']
|
65 | MEssage.canWrite = ['content']
|
66 |
|
67 | schema = {
|
68 | title: {
|
69 | canWrite: () => {}
|
70 | }
|
71 | }
|
72 | ```
|
73 |
|
74 | # 📖 License
|
75 |
|
76 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
|
77 |
|
78 | # 👥 Contributors
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 | <table>
|
87 | <tr>
|
88 | <td align="center"><a href="https://isuvorov.com"><img src="https://avatars2.githubusercontent.com/u/1056977?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Igor Suvorov</b></sub></a><br /><a href="lskjs/lskjs///commits?author=isuvorov" title="Code">💻</a> <a href="#design-isuvorov" title="Design">🎨</a> <a href="#ideas-isuvorov" title="Ideas, Planning, & Feedback">🤔</a></td>
|
89 | </tr>
|
90 | </table>
|
91 |
|
92 |
|
93 |
|
94 |
|
95 | # 👏 Contributing
|
96 |
|
97 | 1. Fork it (<https://github.com/yourname/yourproject/fork>)
|
98 | 2. Create your feature branch (`git checkout -b features/fooBar`)
|
99 | 3. Commit your changes (`git commit -am 'feat(image): Add some fooBar'`)
|
100 | 4. Push to the branch (`git push origin feature/fooBar`)
|
101 | 5. Create a new Pull Request
|
102 |
|
103 | # 📮 Any questions? Always welcome :)
|
104 |
|
105 | * [Email](mailto:hi@isuvorov.com)
|
106 | * [LSK.news – Telegram channel](https://t.me/lskjs)
|
107 | * [Спроси нас в телеграме ;)](https://t.me/lskjschat)
|