-
-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create LaravelInertia.js #436
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: goldrak <[email protected]>
authentication/LaravelInertia.js
Outdated
var dataPageObject; | ||
|
||
dataPageObject = JSON.parse(dataPageJsonString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var dataPageObject = JSON.parse(dataPageJsonString);
authentication/LaravelInertia.js
Outdated
secondMsg.getRequestHeader().setHeader("X-XSRF-TOKEN", decodeURIComponent(csrfTokenValue)); | ||
secondMsg.getRequestHeader().setHeader("Content-Type", "application/json"); | ||
secondMsg.getRequestHeader().setHeader("X-Requested-With", "XMLHttpRequest"); | ||
secondMsg.getRequestHeader().setHeader("Referer", "https://app.opensecdevops.com/login"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd expect this to use baseURL
, if not possible it should be a required parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this a big error of the testing sorry
authentication/LaravelInertia.js
Outdated
secondMsg.getRequestHeader().setHeader("X-XSRF-TOKEN", decodeURIComponent(csrfTokenValue)); | ||
secondMsg.getRequestHeader().setHeader("Content-Type", "application/json"); | ||
secondMsg.getRequestHeader().setHeader("X-Requested-With", "XMLHttpRequest"); | ||
secondMsg.getRequestHeader().setHeader("Referer", "https://app.opensecdevops.com/login"); | ||
secondMsg.getRequestHeader().setHeader("X-Inertia", 'true'); | ||
secondMsg.getRequestHeader().setHeader("X-Inertia-Version", inertiaVersion); | ||
secondMsg.getRequestHeader().setHeader("Accept", "text/html, application/xhtml+xml"); | ||
|
||
// Send cookies | ||
secondMsg.getRequestHeader().setHeader(HttpHeader.COOKIE, "XSRF-TOKEN=" + csrfTokenValue + "; osdo_session=" + cookieSessionValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use secondRequestHeader
instead of the getter.
authentication/LaravelInertia.js
Outdated
helper.sendAndReceive(secondMsg, false); | ||
|
||
// Get the status code of the response. | ||
// Aquí puedes verificar el código de estado de la respuesta para confirmar si la autenticación fue exitosa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to English?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes no problem
// | ||
|
||
// Build message. | ||
var firstRequestURI = new URI(targetURL, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd have expected the URLs to be properly encoded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the problem, it's how I saw it being done here
https://github.com/GoldraK/community-scripts/blob/main/authentication/DjangoAuthentication.js#L29
|
||
|
||
function getRequiredParamsNames() { | ||
return ["Target URL", "Username field", "Password field", "Session Cookie name"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these are not used.
authentication/LaravelInertia.js
Outdated
|
||
|
||
function getOptionalParamsNames() { | ||
return ["Extra POST data"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, go to delete.
The changelog should be updated. |
Signed-off-by: goldrak <[email protected]>
Hello,
Based on Django Auth I have created Laravel + Inertiajs Auth.