mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
refactor: Creation d'un provider et d'un systeme de middleware
This commit is contained in:
11
Front-End/src/utils/gravatar.js
Normal file
11
Front-End/src/utils/gravatar.js
Normal file
@ -0,0 +1,11 @@
|
||||
import crypto from 'crypto';
|
||||
|
||||
export function getGravatarUrl(email, size = 32) {
|
||||
if(email === undefined || typeof email !== 'string') {
|
||||
return 'https://www.gravatar.com/avatar/';
|
||||
}
|
||||
else {
|
||||
const hash = crypto.createHash('md5').update(email.toLowerCase().trim()).digest('hex');
|
||||
return `https://www.gravatar.com/avatar/${hash}?s=${size}&d=identicon`;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user