-
Notifications
You must be signed in to change notification settings - Fork 45
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
AndreasDickow
wants to merge
49
commits into
mkalioby:master
Choose a base branch
from
AndreasDickow:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
f7d06c2
Token delete formdata fix method
AndreasDickow 392b9ef
init internationalization and csp save templates
AndreasDickow 7f2b9a3
fixing csp attributes and translations
AndreasDickow 34510dd
TrustedDevices - start: Minor fixes
jmbizfac 98982ce
Inline Styles removed from all subfiles in template folder
jmbizfac 2c4a48d
Stylesheet imported for respective files
jmbizfac 3e4e62a
javascript exported in own file
jmbizfac 2d8cd96
EMAIL recheck onlicks removed
jmbizfac fb25e34
TOTP Add.html free of onclick events
jmbizfac 9ec9708
All files checked for inline js
jmbizfac 1057987
final adjustments
jmbizfac 9152b6d
translation tags in templates
AndreasDickow 8fe6575
code cleanup
AndreasDickow 1800ff9
code cleanup
AndreasDickow 9c5bda9
todo test redirect html code
AndreasDickow c99c697
template substitutions
AndreasDickow a5803d3
fix attestation privacy warning
AndreasDickow df2c10f
Update requirements.txt
AndreasDickow 5b4fb11
Update setup.py
AndreasDickow 7715b32
Update requirements.txt
AndreasDickow 7ce386d
Update setup.py
AndreasDickow 547c86b
Update setup.py
AndreasDickow d008981
Update requirements.txt
AndreasDickow 8d75755
Update recheck.js
AndreasDickow 1f67349
Update FIDO2.py
AndreasDickow 419f66b
Update add.js
AndreasDickow 92c4f02
Update setup.py
AndreasDickow bc4396d
Update __init__.py
AndreasDickow b273286
Update recheck.js
AndreasDickow ce0686c
Update setup.py
AndreasDickow 9948002
Token delete formdata fix method
AndreasDickow 35ac10c
update merge
AndreasDickow 6ca0895
update merge
AndreasDickow 738c8ee
update fido auth
AndreasDickow eb5b4d1
Update FIDO2.py
AndreasDickow ad063bd
update fido auth
AndreasDickow b7bcf35
update fido auth
AndreasDickow d0af4b5
update fido auth
AndreasDickow d400918
update fido auth
AndreasDickow b325ce3
update fido auth
AndreasDickow ff4e987
internationalization: german texts
AndreasDickow 0db200f
internationalization: german texts
AndreasDickow c7cb057
internationalization: german texts
AndreasDickow aaf072b
internationalization: german texts
AndreasDickow 3002d18
internationalization: german texts
AndreasDickow 6b354b8
internationalization: german texts
AndreasDickow 82ef89c
hide account details from attestation
AndreasDickow 5caccca
remove unneccesary attestation
AndreasDickow fd78e54
fix CVE-2022-42731
AndreasDickow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
.alert-pr { | ||
align-items: center; | ||
} | ||
|
||
.alert-pr > p.success, #res > p.success, .row > success { | ||
color: green; | ||
} | ||
|
||
.panel-body > .paragraph { | ||
padding-left: 15px; | ||
} | ||
|
||
.panel-body { | ||
align-items: center; | ||
} | ||
|
||
#popUpModal { | ||
top: 40px; | ||
} | ||
|
||
#popUpModal > .modal-dialog { | ||
height: 80%; | ||
width: 80%; | ||
} | ||
|
||
#two-factor-steps { | ||
border: 1px solid #ccc; | ||
border-radius: 3px; | ||
padding: 15px; | ||
} | ||
|
||
#two-factor-steps > .row { | ||
margin: 0; | ||
align-items: center; | ||
} | ||
|
||
/* STYLE CHANGES */ | ||
|
||
.no-display { | ||
display: none; | ||
} | ||
|
||
.inline-display { | ||
display: inline; | ||
} | ||
|
||
/* WIDTH AND HEIGHT */ | ||
|
||
.height-50 { | ||
height: 50px; | ||
} | ||
|
||
.width-95-pc { | ||
width: 95%; | ||
} | ||
|
||
.height-34 { | ||
height: 34px; | ||
} | ||
|
||
.width-230 { | ||
width: 230px; | ||
} | ||
|
||
/* PADDINGS */ | ||
|
||
.padding-3 { | ||
padding: 3px; | ||
} | ||
|
||
.padding-top-10 { | ||
padding-top: 10px; | ||
} | ||
|
||
.padding-right-30 { | ||
padding-right: 30px; | ||
} | ||
|
||
.padding-left-0 { | ||
padding-left: 0; | ||
} | ||
|
||
.padding-left-15 { | ||
padding-left: 15px | ||
} | ||
|
||
.padding-left-25 { | ||
padding-left: 25px | ||
} | ||
|
||
|
||
/* MARGINS */ | ||
|
||
.margin-left-50 { | ||
margin-left: 50px | ||
} | ||
|
||
/* FONT AND TEXT */ | ||
|
||
.font-10 { | ||
font-size: 10px; | ||
} | ||
|
||
.font-10-pt { | ||
font-size: 10pt; | ||
} | ||
|
||
.font-16 { | ||
font-size: 16px; | ||
} | ||
|
||
.bold { | ||
font-weight: bold; | ||
} | ||
|
||
.text-uppercase { | ||
text-transform: uppercase; | ||
} | ||
|
||
.font-calibri { | ||
font-family: Calibri, serif; | ||
} | ||
|
||
/* COLOR */ | ||
|
||
.color-gray { | ||
color: #333333; | ||
} | ||
|
||
.color-red { | ||
color: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
$(document).ready(function () { | ||
// 1. If the Document is loaded, add an eventlistener to the object with the id=send-totp | ||
let sendTotp = document.getElementById('send-totp'); | ||
sendTotp.addEventListener('click', check_mode) | ||
// 2. If the Django-variable "mode" == "recheck", then call send_totp() | ||
|
||
}); | ||
|
||
function check_mode() { | ||
const mode = JSON.parse(document.getElementById('recheck-js').textContent); | ||
if (mode === 'recheck') { | ||
send_totp(); | ||
} | ||
} | ||
|
||
function send_totp() { | ||
const form = $('#formLogin'); | ||
var formData = new FormData(form); | ||
$.ajax({ | ||
"url": "{% url 'totp_recheck' %}", method: "POST", dataType: "JSON", | ||
data: {"csrfmiddlewaretoken": formData.get('csrf_token'), "otp": $("#otp").val()}, | ||
success: function (data) { | ||
if (data["recheck"]) | ||
mfa_success_function(); | ||
else { | ||
mfa_failed_function(); | ||
} | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
function begin_reg(){ | ||
var formData = new FormData($('#fido2_form')) | ||
fetch(formData.get('begin'),{}).then(function(response) { | ||
if(response.ok) | ||
{ | ||
return response.arrayBuffer(); | ||
} | ||
throw new Error('Error getting registration data!'); | ||
}).then(CBOR.decode).then(function(options) { | ||
options.publicKey.attestation="direct" | ||
console.log(options) | ||
|
||
return navigator.credentials.create(options); | ||
}).then(function(attestation) { | ||
return fetch(formData.get('complete'), { | ||
method: 'POST', | ||
headers: {'Content-Type': 'application/cbor'}, | ||
body: CBOR.encode({ | ||
"attestationObject": new Uint8Array(attestation.response.attestationObject), | ||
"clientDataJSON": new Uint8Array(attestation.response.clientDataJSON), | ||
}) | ||
}); | ||
}).then(function(response) { | ||
|
||
var stat = response.ok ? 'successful' : 'unsuccessful'; | ||
return response.json() | ||
}).then(function (res) | ||
{ | ||
if (res["status"] =='OK') | ||
$("#res").html("<div class='alert alert-success'>Registered Successfully, <a href='"+formData.get('redirect')+"'> "+formData.get('success')+"</a></div>") | ||
else | ||
$("#res").html("<div class='alert alert-danger'>Registration Failed as " + res["message"] + ", <a href='javascript:void(0)' onclick='begin_reg()'> try again or <a href='"+formData.get('home')+"'> Go to Security Home</a></div>") | ||
|
||
|
||
}, function(reason) { | ||
$("#res").html("<div class='alert alert-danger'>Registration 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>") | ||
}) | ||
} | ||
$(document).ready(function (){ | ||
ua=new UAParser().getResult() | ||
if (ua.browser.name == "Safari" || ua.browser.name == "Mobile Safari" ) | ||
{ | ||
$("#res").html("<button class='btn btn-success' onclick='begin_reg()'>Start...</button>") | ||
} | ||
else | ||
{ | ||
setTimeout(begin_reg, 500) | ||
} | ||
}) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
function authen() { | ||
const begin_url = $('#begin').value; | ||
const complete_url = $('u2f_login').attr('action'); | ||
const mode = $('u2f_login').attr('name') === 'complete' ? 'auth' : 'recheck'; | ||
fetch(begin_url, { | ||
method: 'GET', | ||
}).then(function (response) { | ||
if (response.ok) return response.arrayBuffer(); | ||
throw new Error('No credential available to authenticate!'); | ||
}).then(CBOR.decode).then(function (options) { | ||
console.log(options) | ||
return navigator.credentials.get(options); | ||
}).then(function (assertion) { | ||
res = CBOR.encode({ | ||
"credentialId": new Uint8Array(assertion.rawId), | ||
"authenticatorData": new Uint8Array(assertion.response.authenticatorData), | ||
"clientDataJSON": new Uint8Array(assertion.response.clientDataJSON), | ||
"signature": new Uint8Array(assertion.response.signature) | ||
}); | ||
|
||
return fetch(complete_url, { | ||
|
||
method: 'POST', | ||
headers: {'Content-Type': 'application/cbor'}, | ||
body: res, | ||
|
||
}).then(function (response) { | ||
if (response.ok) return res = response.json() | ||
}).then(function (res) { | ||
if (res.status == "OK") { | ||
$("#msgdiv").addClass("alert alert-success").removeClass("alert-danger") | ||
$("#msgdiv").html("Verified....please wait") | ||
if (mode == "auth") { | ||
window.location.href = res.redirect; | ||
} else if (mode === "recheck") { | ||
mfa_success_function(); | ||
} | ||
|
||
} 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>") | ||
|
||
if (mode === "recheck") { | ||
mfa_failed_function(); | ||
} | ||
} | ||
}) | ||
|
||
}) | ||
|
||
} | ||
|
||
$(document).ready(function () { | ||
if (location.protocol != 'https:') { | ||
$("#main_paragraph").addClass("alert alert-danger") | ||
$("#main_paragraph").html("FIDO2 must work under secure context") | ||
} else { | ||
ua = new UAParser().getResult() | ||
if (ua.browser.name == "Safari" || ua.browser.name == "Mobile Safari") | ||
$("#res").html("<button class='btn btn-success' onclick='authen()'>Authenticate...</button>") | ||
else | ||
authen() | ||
} | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
var key = ""; | ||
$(document).ready(function addToken() { | ||
$.ajax({ | ||
"url": "{% url 'get_new_otop' %}", dataType: "JSON", | ||
success: function (data) { | ||
window.key = data.secret_key; | ||
var qr = new QRious({ | ||
element: document.getElementById('qr'), | ||
value: data.qr | ||
}); | ||
$("#second_step").show() | ||
} | ||
}) | ||
|
||
// Replace Onclick | ||
// $('showTOTP').on('click', showTOTP); | ||
document.getElementById('show-TOTP').addEventListener('click', showTOTP); | ||
document.getElementById('show-key').addEventListener('click', showKey); | ||
document.getElementById('verify').addEventListener('click', verify); | ||
|
||
}); | ||
|
||
function showKey() { | ||
$("#modal-title").html("Your Secret Key") | ||
$("#modal-body").html("<pre>" + window.key + "</pre") | ||
$("#popUpModal").modal('show') | ||
} | ||
|
||
function verify() { | ||
answer = $("#answer").val() | ||
$.ajax({ | ||
"url": "{% url 'verify_otop' %}?key=" + key + "&answer=" + answer, | ||
success: function (data) { | ||
if (data == "Error") | ||
alert("You entered wrong numbers, please try again") | ||
else { | ||
alert("Your authenticator is added successfully.") | ||
window.location.href = "{{ redirect_html }}" | ||
} | ||
} | ||
}) | ||
} | ||
|
||
function showTOTP() { | ||
$("#modal-title").html("One Time Password Apps") | ||
html = "<div class='row'><ul>" + | ||
"<li>Android: <a href='https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2' target='_blank'>Google Authenticator</a> | <a href='https://play.google.com/store/apps/details?id=com.authy.authy' target='_blank'>Authy</a></li>" | ||
html += "<li>iPhone/iPad: <a href='https://itunes.apple.com/us/app/authy/id494168017' target='_blank'>Authy</a></li> " | ||
html += "<li>Chrome: <a href='https://chrome.google.com/webstore/detail/authenticator/bhghoamapcdpbohphigoooaddinpkbai?hl=en'>Google Authenticator</a> | <a href='https://chrome.google.com/webstore/detail/authy/gaedmjdfmmahhbjefcbgaolhhanlaolb?hl=en' target='_blank'>Authy</a></li>" | ||
html += "</ul></div>" | ||
$("#modal-body").html(html) | ||
$('#popUpModal').modal('show') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
$(document).ready(function () { | ||
document.getElementById('send-totp').addEventListener('click', check_mode); | ||
}) | ||
|
||
function check_mode() { | ||
const mode = JSON.parse(document.getElementById('recheck-js').textContent); | ||
if (mode === 'recheck') { | ||
send_totp(); | ||
} | ||
} | ||
|
||
function send_totp() { | ||
$.ajax({ | ||
"url": "{% url 'totp_recheck' %}", method: "POST", dataType: "JSON", | ||
data: {"csrfmiddlewaretoken": "{{ csrf_token }}", "otp": $("#otp").val()}, | ||
success: function (data) { | ||
if (data["recheck"]) | ||
mfa_success_function(); | ||
else { | ||
mfa_failed_function(); | ||
} | ||
} | ||
}) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
$(document).ready(function () { | ||
document.getElementById('formLogin').addEventListener('submit', checkFlag); | ||
}) | ||
|
||
function checkFlag() { | ||
if ($("#agree").is(":checked")) | ||
return true; | ||
else | ||
alert("Please agree to the statement first"); | ||
return false; | ||
} | ||
|
||
function checkTrusted() { | ||
$.ajax({ | ||
url: "{% url 'td_checkTrusted' %}", | ||
success: function (data) { | ||
if (data == "OK") | ||
window.location.href = "{% url 'td_securedevice' %}"; | ||
else | ||
setTimeout('checkTrusted()', 2000) | ||
} | ||
|
||
}) | ||
|
||
} | ||
|
||
$(document).ready(checkTrusted()) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Dont you need these with {% trans %}?