1.3.6-alpha.4 • Published 3 months ago

@gaopeng123/rc-login-jsencrypt v1.3.6-alpha.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

rc-login-jsencrypt

基于jsencrypt加密的登录组件

Usage

import * as React from 'react';
import * as ReactDOM from 'react-dom';
import {RCLoginJSEncrypt} from "@gaopeng123/rc-login-jsencrypt";

const encryptPublicKey = 'xxx';

const headers = {
    clientId: 'xxx',
    secret: 'xxx',
};

const App = () => {
    return (
        <RCLoginJSEncrypt
            encryptPublicKey={encryptPublicKey}
            clientId={headers.clientId}
            secret={headers.secret}
            getCaptcha={async () => {
                return new Promise<RCLoginCaptchaProps>((resolve, reject) => {
                    get(`/testAuth/api/nebula/auth/token/v1/captcha`, {
                        params: {
                            width: 80,
                            height: 30
                        },
                        headers: headers
                    }).then((res: any) => {
                        console.log(res)
                        resolve(res)
                    })
                })
            }}
            phoneLoginUrl={true}
            handleSubmit={({headers, body, loginType, data, encryptor}) => {
                console.log(headers, body, loginType, data, encryptor);
                return new Promise((resolve, reject) => {
                    post(`/testAuth/api/nebula/auth/token/v1/shrLogin`, {
                        headers: headers,
                        body: body
                    }).then((res) => {
                        console.log(res);
                    });
                    resolve(true)
                })
            }}
            forgotPasswordUrl={true}
            onResetPasswordSubmit={(data) => {
                console.log(data);
                return new Promise((resolve, reject)=> {
                    setTimeout(()=> {
                        // 范围true关闭窗口 false不关闭
                        resolve(false);
                    }, 2000);
                }).catch(()=> {

                });
            }}
            mainStyle={{backgroundImage: 'url(./assets/background.jpg)'}}
            bodyStyle={{right: '200px;'}}
            keeplogged={true}
            title="食堂管理系统"
        />
    );
};

ReactDOM.render(<App/>, document.getElementById('root'));

useFeishuLogin

飞书免登录

const [code, setCode] = useFeishuLogin({
        id: 'testapp', // 应用标识 字符串即可
        url: 'https://xxx', // 飞书登录地址
        app_id: '', // 申请的飞书应用id
        redirect_uri: 'https://xxx' // 配置的重定向地址
    });

    useEffect(() => {
        if (code) {
            // 调用服务端接口去交换token 交换完成后最好在调用下setCode();
            // 登录成功或者失败后 code就不能用了 所以要调用下
            setCode();
        }
    }, [code]);
1.3.6-alpha.3

3 months ago

1.3.6-alpha.4

3 months ago

1.3.6-alpha.2

3 months ago

1.3.5

3 months ago

1.3.4

4 months ago

1.3.2

5 months ago

1.3.0

5 months ago

1.3.1-alpha.0

5 months ago

1.2.4

10 months ago

1.2.19-alpha.2

6 months ago

1.2.18-alpha.1

8 months ago

1.2.13

9 months ago

1.2.11

9 months ago

1.2.17

8 months ago

1.2.15

9 months ago

1.1.1

12 months ago

1.1.0

12 months ago

1.1.4

12 months ago

1.1.3

12 months ago

1.0.4

12 months ago

1.1.2

12 months ago

1.0.2

1 year ago

0.9.6

1 year ago

1.0.2-alpha.10

1 year ago

1.0.3

1 year ago

0.6.10

1 year ago

0.6.12

1 year ago

0.6.11

1 year ago

0.6.18

1 year ago

0.6.17

1 year ago

0.8.1

1 year ago

0.7.2

1 year ago

0.7.1

1 year ago

0.6.2

1 year ago

0.7.3

1 year ago

0.5.0

2 years ago

0.7.0

1 year ago

0.5.1

2 years ago

0.4.5

2 years ago

0.4.4

2 years ago

0.4.7

2 years ago

0.4.6

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.0

2 years ago

0.2.18

2 years ago