fix login drawer logics

This commit is contained in:
SrGooglo 2023-06-30 18:18:22 +00:00
parent 94f500aa8c
commit f4ba64531a
4 changed files with 28 additions and 4 deletions

View File

@ -187,10 +187,17 @@ class ComtyApp extends React.Component {
} }
}) })
}, },
openRegisterForm: async () => { openRegisterForm: async (options = {}) => {
app.DrawerController.open("Register", UserRegister, { app.DrawerController.open("Register", UserRegister, {
allowMultiples: false, defaultLocked: options.defaultLocked ?? false,
panel: true, componentProps: {
sessionController: this.sessionController,
},
props: {
bodyStyle: {
height: "100%",
}
},
}) })
}, },
// Opens the notification window and sets up the UI for the notification to be displayed // Opens the notification window and sets up the UI for the notification to be displayed

View File

@ -180,6 +180,7 @@ export class Drawer extends React.Component {
} }
const componentProps = { const componentProps = {
...this.options.componentProps, ...this.options.componentProps,
locked: this.state.locked,
lock: this.lock, lock: this.lock,
unlock: this.unlock, unlock: this.unlock,
events: this.events, events: this.events,

View File

@ -79,11 +79,17 @@ export default class Login extends React.Component {
} }
onClickRegister = () => { onClickRegister = () => {
if (this.props.locked) {
this.props.unlock()
}
if (typeof this.props.close === "function") { if (typeof this.props.close === "function") {
this.props.close() this.props.close()
} }
app.eventBus.emit("app.createRegister") app.controls.openRegisterForm({
defaultLocked: this.props.locked
})
} }
toggleLoading = (to) => { toggleLoading = (to) => {

View File

@ -349,9 +349,19 @@ export default (props) => {
antd.message.success("User registered successfully.") antd.message.success("User registered successfully.")
} }
if (props.locked) {
props.unlock()
}
if (typeof props.close === "function") { if (typeof props.close === "function") {
props.close() props.close()
} }
if (app.isMobile) {
app.controls.openLoginForm({
defaultLocked: props.locked,
})
}
} }
return <StepsForm return <StepsForm