Merge pull request #16705 from strapi/fix/generate-admin-user-hash

This commit is contained in:
Jean-Sébastien Herbaux 2023-05-15 09:20:07 +02:00 committed by GitHub
commit 833f017981
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,7 @@ const crypto = require('crypto');
*/
const generateAdminUserHash = (strapi) => {
const ctx = strapi?.requestContext?.get();
if (!ctx?.state?.user) {
if (!ctx?.state?.user?.email) {
return '';
}
return crypto.createHash('sha256').update(ctx.state.user.email).digest('hex');