Skip to content
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

Token delete formdata fix method #53

Open
wants to merge 49 commits into
base: master
Choose a base branch
from

Conversation

AndreasDickow
Copy link
Contributor

Delete token used the wrong method to access formdata, I exchanged it to POST instead of GET and it fixed the error on submit

@mkalioby
Copy link
Owner

mkalioby commented Sep 5, 2021

Why the change if the AJAX is sent over GET and not POST?

{
if (res["status"] =='OK')
$("#res").html("<div class='alert alert-success'>Registered Successfully, <a href='"+formData.get('redirect')+"'> "+formData.get('success')+"</a></div>")
else
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont you need these with {% trans %}?



}, function(reason) {
$("#res").html("<div class='alert alert-danger'>Registeration Failed as " +reason +", <a href='javascript:void(0)' onclick='begin_reg()'> try again </a> or <a href='"+formData.get('home')+"'> Go to Security Home</a></div>")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This as well?

}
else {
$("#msgdiv").addClass("alert alert-danger").removeClass("alert-success")
$("#msgdiv").html("Verification Failed as " + res.message + ", <a href='javascript:void(0)' onclick='authen())'> try again</a> or <a href='javascript:void(0)' onclick='history.back()'> Go Back</a>")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This too?

}
else if(formData.get('mode') === 'recheck') {
$.ajax({
"url":"{% url 'u2f_recheck' %}",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won’t work under {% static %}

function deleteKey(id,name,confirm_url)
{
$("#modal-title").html("Confirm Delete")
$("#modal-body").html("Are you sure you want to delete '"+name+"'? you may lose access to your system if this your only 2FA.");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall be translated, isn’t it?

window.mfa_success_function=success_func;
window.mfa_failed_function=fail_func;
$.ajax({
"url":"{% url 'mfa_recheck' %}",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wont work with static

}
else
{
$("#modal-title").html("Recheck Indentity")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall be translated, isn’t it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I'm not done yet, my intention was to do internationalization and be CSP conform without inline javascript or css. I will provide further updates soon.

Copy link
Owner

@mkalioby mkalioby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the effort, please consider the comment

@mkalioby
Copy link
Owner

Hello,

Any updates about this PR.

@AndreasDickow
Copy link
Contributor Author

Still on it, to aquire strict CSP rules conformity, we have to rewrite some javascript.

@mkalioby
Copy link
Owner

Ok, can you share the rules and i can work with you on them, thanks for your help

Copy link
Owner

@mkalioby mkalioby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test this version? as it wont work as the AJAX gets the URLs through a {%url%} tag which wont work with static JS.

@AndreasDickow
Copy link
Contributor Author

I now stripped as recomended all url tags from js files see my latest implemenetation master...AndreasDickow:master. Can you please review the code?

@AndreasDickow
Copy link
Contributor Author

We have now included translation tags for international usage and added a german translation of Status Messages. Additional the library is now conform with strict CSP settings not allowing javascript and style in html files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants