mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #7051 from overleaf/jpa-admin-token-access-www
[web] make sure that token access links are on non admin domain GitOrigin-RevId: 2cfadbe67244a15803caa68747de2ed33fc6d4fb
This commit is contained in:
parent
34627b98a2
commit
06bf7347d4
2 changed files with 9 additions and 1 deletions
|
@ -8,6 +8,7 @@ import { setProjectAccessLevel } from '../utils/api'
|
|||
import CopyLink from '../../../shared/components/copy-link'
|
||||
import { useProjectContext } from '../../../shared/context/project-context'
|
||||
import * as eventTracking from '../../../infrastructure/event-tracking'
|
||||
import { useUserContext } from '../../../shared/context/user-context'
|
||||
|
||||
export default function LinkSharing() {
|
||||
const [inflight, setInflight] = useState(false)
|
||||
|
@ -204,6 +205,8 @@ export function ReadOnlyTokenLink() {
|
|||
}
|
||||
|
||||
function AccessToken({ token, path, tooltipId }) {
|
||||
const { isAdmin } = useUserContext()
|
||||
|
||||
if (!token) {
|
||||
return (
|
||||
<pre className="access-token">
|
||||
|
@ -214,7 +217,11 @@ function AccessToken({ token, path, tooltipId }) {
|
|||
)
|
||||
}
|
||||
|
||||
const link = `${window.location.origin}${path}${token}`
|
||||
let origin = window.location.origin
|
||||
if (isAdmin) {
|
||||
origin = window.ExposedSettings.siteUrl
|
||||
}
|
||||
const link = `${origin}${path}${token}`
|
||||
|
||||
return (
|
||||
<pre className="access-token">
|
||||
|
|
|
@ -8,6 +8,7 @@ UserContext.Provider.propTypes = {
|
|||
value: PropTypes.shape({
|
||||
user: PropTypes.shape({
|
||||
id: PropTypes.string,
|
||||
isAdmin: PropTypes.boolean,
|
||||
email: PropTypes.string,
|
||||
allowedFreeTrial: PropTypes.boolean,
|
||||
first_name: PropTypes.string,
|
||||
|
|
Loading…
Reference in a new issue