Skip to content

Commit

Permalink
feat: code merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoyafng committed Jan 3, 2024
2 parents f9044e3 + e99be69 commit c50636c
Show file tree
Hide file tree
Showing 31 changed files with 312 additions and 65 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"packages/*"
],
"useWorkspaces": true,
"version": "4.5.2-alpha.8"
"version": "4.5.5"
}
15 changes: 15 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions packages/guard-core-v4/example.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { Guard, User, GuardMode, GuardLocalConfig } from './src/index'
import { Guard, User, GuardLocalConfig } from './src/index'

import { React, render } from 'shim-react'

import * as facePlugin from 'face-api.js'

const App = () => {
const appId = '657ac9d85a4671fc136b2216'
const appId = '658b08e8d5089b160caace66'
// const deviceId = '6486be0f60e50cb92678a468' //如要使用必须使用开启元数据对的 用户池 测试

const config: Partial<GuardLocalConfig> = {
// mode: GuardMode.Modal,
// lang: 'en-US'
host: 'https://ddddd.why.lixpng.top'
// lang: 'en-US',
host: 'https://passkey.cj.local'
}

const onLogin = (userInfo: User) => {
Expand Down
32 changes: 23 additions & 9 deletions packages/guard-core-v4/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/guard-core-v4/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@authing/guard-core",
"version": "4.5.2-alpha.8",
"version": "4.5.5",
"description": "Authing Guard Component for core codes, only be used to internal",
"types": "dist/typings/src/index.d.ts",
"files": [
Expand All @@ -18,6 +18,7 @@
"author": "https://github.com/authing",
"license": "MIT",
"dependencies": {
"@github/webauthn-json": "^2.1.1",
"authing-js-sdk": "^4.23.49",
"classnames": "^2.3.1",
"i18next": "^22.4.11",
Expand Down
61 changes: 35 additions & 26 deletions packages/guard-core-v4/scripts/webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,41 @@ const webpackBaseConfigFn = require('./webpack.base.config')
const { resolve } = require('./utils')

const reactVersion = '16'
const fs = require('fs')

module.exports = merge({}, webpackBaseConfigFn({
reactVersion
}), {
mode: 'development',
entry: resolve('example.tsx'),
output: {
filename: 'guard.min.js',
path: resolve(`dist/esm-react${reactVersion}`),
library: {
type: 'module'
module.exports = merge(
{},
webpackBaseConfigFn({
reactVersion
}),
{
mode: 'development',
entry: resolve('example.tsx'),
output: {
filename: 'guard.min.js',
path: resolve(`dist/esm-react${reactVersion}`),
library: {
type: 'module'
}
},
experiments: {
outputModule: true
},
resolve: {
fallback: {
fs: false,
crypto: false
}
},
devServer: {
// https: {
// key: fs.readFileSync('/Users/jayl/Code/authing/Guard/test.local.key'),
// cert: fs.readFileSync('/Users/jayl/Code/authing/Guard/test.local.crt'),
// },
// host: 'passkey.cj.local',
port: 8443,
hot: true,
open: true
}
},
experiments: {
outputModule: true
},
resolve: {
fallback: {
fs: false,
crypto: false
}
},
devServer: {
host: 'localhost',
port: 8090,
hot: true,
open: true
}
})
)
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export const ResetPassword = (props: ResetPasswordProps) => {
// setPasswordErrorTextShow,
// } = usePasswordErrorText()
const onFinish = async (values: any) => {
submitButtonRef.current?.onSpin(true)
// 校验手机号和验证码
let identify = values.identify
let code = values.code
Expand Down Expand Up @@ -112,6 +113,7 @@ export const ResetPassword = (props: ResetPasswordProps) => {
context
.then((r: any) => {
const { code } = r
submitButtonRef.current?.onSpin(false)
if (code !== 200) {
message.error(r?.message)
return
Expand Down
2 changes: 2 additions & 0 deletions packages/guard-core-v4/src/ForgetPassword/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export const GuardForgetPassword: React.FC = () => {
const { post } = getGuardHttp()
let submitBtnRef = useRef<any>(null)
const onFinish = async () => {
submitBtnRef.current?.onSpin(true)
// 重置密码
let data = form.getFieldsValue()
const newPassword = await authClient.options?.encryptFunction?.(
Expand All @@ -94,6 +95,7 @@ export const GuardForgetPassword: React.FC = () => {

res
.then((r: any) => {
submitBtnRef.current?.onSpin(false)
const { code } = r
if (code === ApiCode.UNSAFE_PASSWORD_TIP) {
setPasswordErrorTextShow(true)
Expand Down
16 changes: 14 additions & 2 deletions packages/guard-core-v4/src/Login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import { useLoginMultiple } from './hooks/useLoginMultiple'
import { useGuardView } from '../Guard/core/hooks/useGuardView'

import { LoginWithAuthingOtpPush } from './core/withAuthingOtpPush/index'
// import { LoginWithPasskey } from './core/withPasskey'

import { usePostMessage } from './socialLogin/postMessage'

Expand Down Expand Up @@ -799,6 +800,16 @@ export const GuardLoginView: React.FC<{ isResetPage?: boolean }> = ({
)
}, [ms, onLoginSuccess, t, backfillData, multipleInstance, agreements])

// const PasskeyTab = useMemo(
// () =>
// ms?.includes(LoginMethods.Passkey) && (
// <Tabs.TabPane key={LoginMethods.Passkey} tab={'Passkey'}>
// <LoginWithPasskey />
// </Tabs.TabPane>
// ),
// [ms]
// )

// 登录方式对应 tab Component
const tabMap = useMemo(() => {
return {
Expand All @@ -820,9 +831,9 @@ export const GuardLoginView: React.FC<{ isResetPage?: boolean }> = ({
LoginMethods.AuthingOtpPush
].includes(tabName)
)

if (total) {
return getSortTabs(total, config.defaultLoginMethod ?? '').map(
const sortedTable = getSortTabs(total, config.defaultLoginMethod ?? '')
const tabs = sortedTable.map(
tabName =>
tabMap[
tabName as
Expand All @@ -833,6 +844,7 @@ export const GuardLoginView: React.FC<{ isResetPage?: boolean }> = ({
| LoginMethods.AuthingOtpPush
]
)
return tabs
}
return null
}, [config.defaultLoginMethod, ms, tabMap])
Expand Down
Loading

0 comments on commit c50636c

Please sign in to comment.