mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
Added unit tests for models.Invite.add
no issue - replaced token creation by `lib.common.security` - added unit tests for adding invites - allow a different invite status for internal access
This commit is contained in:
parent
5d1a4418bd
commit
a0ee411e6e
@ -2,7 +2,25 @@
|
||||
|
||||
const crypto = require('crypto');
|
||||
|
||||
exports.resetToken = {
|
||||
module.exports.generateHash = function generateHash(options) {
|
||||
options = options || {};
|
||||
|
||||
const hash = crypto.createHash('sha256'),
|
||||
expires = options.expires,
|
||||
email = options.email,
|
||||
secret = options.secret;
|
||||
|
||||
let text = '';
|
||||
|
||||
hash.update(String(expires));
|
||||
hash.update(email.toLocaleLowerCase());
|
||||
hash.update(String(secret));
|
||||
|
||||
text += [expires, email, hash.digest('base64')].join('|');
|
||||
return new Buffer(text).toString('base64');
|
||||
};
|
||||
|
||||
module.exports.resetToken = {
|
||||
generateHash: function generateHash(options) {
|
||||
options = options || {};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user