Reset question & answer via browser Console

This script can be run right in the browser console and resets the users question and answer.

Its set up to reset it to the date when it runs, please notify the user to reset their Q&A after this to something they know, because the question: What's today's date, will no longer work beyond the reset date.

Just copy paste the script below into your browser console:

//## with courtesy of Realconnections - *2019

// steps to take:
// #1 Go to the users profile - any page of the user is ok.
// #2 Open up the developertools in your browser
// #3 go to the console tab
// #4 Copy the Javascript below
// #5 Paste the script into the console
// #6 Press enter
// #7 Check outcome of script; should be today's date
// #8 Copy and the answer and pass it along to the enduser.
// #9 TIP! Tell the enduser to change that security question, as it is set to today's date. Tomorrow will be different.

// get today
var objToday = new Date(),
dayOfMonth = objToday.getDate(),
months = new Array('january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'oktober', 'november', 'december'),
curMonth = months[objToday.getMonth()],
curYear = objToday.getFullYear();

var today = curMonth + " " + dayOfMonth + " " + curYear;

// find the user ID from the URL
var href = window.location.href.split('/')
var userID = href[href.length-1];
var domain = href[2];

// set up the request
var xmlhttp = new XMLHttpRequest();"PUT", "https://"+domain+"/api/v1/users/"+userID);
xmlhttp.setRequestHeader("Content-Type", "application/json");
xmlhttp.setRequestHeader("Accept", "application/json");
xmlhttp.setRequestHeader("x-requested-with", "XMLHttpRequest");
xmlhttp.setRequestHeader("x-okta-xsrftoken", document.querySelector('#_xsrfToken').innerText);

// set the new security question by sending it
"credentials": {
"recovery_question": {
"question": "What is today's date?",
"answer": today

xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState === 4) {
console.log('succesvol, de nieuwe security question is:');

console.log('What is the date of today?');