Skip to content

Commit

Permalink
Autoopen login modal when it contains modal=login query string (#1604)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalp authored May 21, 2023
1 parent 2ad2230 commit 0ad2df1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions frontend/src/components/Navbar/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { connect } from "react-redux"
import * as overlay from "../../reducers/overlay"
import RegisterButton from "../RegisterButton"
import SignInButton from "../SignInButton"
import SignInModalAutoOpen from "../SignInModalAutoOpen"
import NavbarBranding from "./NavbarBranding"
import NavbarExtraMenu from "./NavbarExtraMenu"
import NavbarNotificationsDropdown from "./NavbarNotificationsDropdown"
Expand Down Expand Up @@ -96,6 +97,7 @@ export function Navbar({
{!user && !authDelegated && (
<RegisterButton className="btn-navbar-register" />
)}
{!user && !authDelegated && <SignInModalAutoOpen />}
</div>
</div>
)
Expand Down
18 changes: 18 additions & 0 deletions frontend/src/components/SignInModalAutoOpen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from "react"
import modal from "../services/modal"
import SignInModal from "./sign-in"

class SignInModalAutoOpen extends React.Component {
componentDidMount() {
const query = window.document.location.search
if (query === "?modal=login") {
window.setTimeout(() => modal.show(<SignInModal />), 300)
}
}

render() {
return null
}
}

export default SignInModalAutoOpen
2 changes: 1 addition & 1 deletion misago/static/misago/js/misago.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion misago/static/misago/js/misago.js.map

Large diffs are not rendered by default.

0 comments on commit 0ad2df1

Please sign in to comment.