Some further work, logout and preview appear to be working much better now.
This commit is contained in:
parent
a1fd261af6
commit
871e9b123e
|
@ -1,3 +1,3 @@
|
||||||
Cypress.Cookies.defaults({
|
Cypress.Cookies.defaults({
|
||||||
preserve: "builder:token",
|
preserve: "budibase:builder:local",
|
||||||
})
|
})
|
||||||
|
|
|
@ -84,7 +84,8 @@
|
||||||
<Button
|
<Button
|
||||||
secondary
|
secondary
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
document.cookie = 'budibase:token=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'
|
// reset cookies for this app
|
||||||
|
document.cookie = `budibase:${application}:local=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;`
|
||||||
window.open(`/${application}`)
|
window.open(`/${application}`)
|
||||||
}}>
|
}}>
|
||||||
Preview
|
Preview
|
||||||
|
|
|
@ -9,7 +9,7 @@ export const load = async (page, screens, url, host = "test.com") => {
|
||||||
const cookieJar = new jsdom.CookieJar()
|
const cookieJar = new jsdom.CookieJar()
|
||||||
const cookie = `${btoa("{}")}.${btoa('{"appId":"TEST_APP_ID"}')}.signature`
|
const cookie = `${btoa("{}")}.${btoa('{"appId":"TEST_APP_ID"}')}.signature`
|
||||||
cookieJar.setCookie(
|
cookieJar.setCookie(
|
||||||
`budibase:local:TEST_APP_ID=${cookie};domain=${host};path=/`,
|
`budibase:TEST_APP_ID:local=${cookie};domain=${host};path=/`,
|
||||||
fullUrl,
|
fullUrl,
|
||||||
{
|
{
|
||||||
looseMode: false,
|
looseMode: false,
|
||||||
|
|
|
@ -34,7 +34,7 @@ exports.defaultHeaders = appId => {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
Cookie: [`builder:token=${builderToken}`],
|
Cookie: [`budibase:builder=${builderToken}:local`],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ const createUserWithPermissions = async (
|
||||||
|
|
||||||
const loginResult = await request
|
const loginResult = await request
|
||||||
.post(`/api/authenticate`)
|
.post(`/api/authenticate`)
|
||||||
.set({ Cookie: `budibase:${appId}=${anonToken}` })
|
.set({ Cookie: `budibase:${appId}:local=${anonToken}` })
|
||||||
.send({ username, password })
|
.send({ username, password })
|
||||||
|
|
||||||
// returning necessary request headers
|
// returning necessary request headers
|
||||||
|
|
|
@ -37,6 +37,6 @@ exports.getAppId = ctx => {
|
||||||
* @returns {string} The name of the token trying to find
|
* @returns {string} The name of the token trying to find
|
||||||
*/
|
*/
|
||||||
exports.getCookieName = (appId = null) => {
|
exports.getCookieName = (appId = null) => {
|
||||||
let mid = env.CLOUD ? "cloud" : "local"
|
let environment = env.CLOUD ? "cloud" : "local"
|
||||||
return `budibase:${mid}:${appId ? appId : "builder"}`
|
return `budibase:${appId ? appId : "builder"}:${environment}`
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const logOut = () => {
|
const logOut = () => {
|
||||||
document.cookie =
|
// TODO: not the best way to clear cookie, try to find better way
|
||||||
"budibase:token=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;"
|
const appId = location.pathname.split("/")[1]
|
||||||
location.reload()
|
if (appId) {
|
||||||
|
for (let environment of ["local", "cloud"]) {
|
||||||
|
document.cookie = `budibase:${appId}:${environment}=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
location.href=`/${appId}`
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue