We noticed an indicident where a user had successfully received their verification email and followed it to verify their account. However, the raw json data still shows the “email_verified” as false, and we don’t have a way to manually check up on this. The issue now is that our database correctly set the verified column to true for this user, but the auth0 json we check is false, and we check it on the json variable to see if we should re-send verification email if X time has passed and they log on again.
I set the email verified in our DB using the custom database action script under Verify, with:
function verify (email, callback) {
//this example uses the "tedious" library
//more info here: http://pekim.github.io/tedious/index.html
var Connection = require('tedious@1.11.0').Connection;
var Request = require('tedious@1.11.0').Request;
var TYPES = require('tedious@1.11.0').TYPES;
var connection = new Connection({
userName: configuration.username,
password: configuration.password,
server: configuration.server,
options: {
database: configuration.database_new,
encrypt: true
}
});
var query = 'UPDATE [User].UserCredentials SET EmailConfirmed = 1 ' +
'WHERE Email = @Email';
connection.on('debug', function(text) {
// Uncomment next line in order to enable debugging messages
// console.log(text);
}).on('errorMessage', function(text) {
console.log(JSON.stringify(text, null, 2));
}).on('infoMessage', function(text) {
// Uncomment next line in order to enable information messages
// console.log(JSON.stringify(text, null, 2));
});
connection.on('connect', function (err) {
if (err) { return callback(err); }
var request = new Request(query, function (err, rows) {
if (err) { return callback(err); }
console.log('rows: ' + rows);
callback(null, rows > 0);
});
request.addParameter('Email', TYPES.VarChar, email);
connection.execSql(request);
});
}
The saving in DB is successful, but somehow the email_verified on the user JSON is still false