mirror of
https://github.com/Foltik/Shimapan
synced 2025-01-07 08:42:49 -05:00
Change exp field to expires
This commit is contained in:
parent
230f9c2415
commit
c9e250a68e
@ -32,7 +32,7 @@ var InviteSchema = mongoose.Schema({
|
|||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
|
|
||||||
exp: {
|
expires: {
|
||||||
type: Date,
|
type: Date,
|
||||||
default: null
|
default: null
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,11 @@ var UserSchema = mongoose.Schema({
|
|||||||
default: 0
|
default: 0
|
||||||
},
|
},
|
||||||
|
|
||||||
|
inviteCount: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
|
||||||
date: {
|
date: {
|
||||||
type: Date,
|
type: Date,
|
||||||
default: Date.now
|
default: Date.now
|
||||||
|
@ -55,7 +55,7 @@ async function validateInvite(code) {
|
|||||||
if (invite.used)
|
if (invite.used)
|
||||||
return {valid: false, message: 'Invite already used.'};
|
return {valid: false, message: 'Invite already used.'};
|
||||||
|
|
||||||
if (invite.exp != null && invite.exp < Date.now())
|
if (invite.expires != null && invite.expires < Date.now())
|
||||||
return {valid: false, message: 'Invite expired.'};
|
return {valid: false, message: 'Invite expired.'};
|
||||||
|
|
||||||
return {valid: true, invite: invite};
|
return {valid: true, invite: invite};
|
||||||
|
@ -30,7 +30,7 @@ after(() => {
|
|||||||
server.close();
|
server.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Accounts', function() {
|
describe('Authentication', function() {
|
||||||
beforeEach(async () => util.clearDatabase());
|
beforeEach(async () => util.clearDatabase());
|
||||||
|
|
||||||
describe('/POST register', () => {
|
describe('/POST register', () => {
|
||||||
@ -87,7 +87,7 @@ describe('Accounts', function() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
it('MUST NOT register an expired invite', async () =>
|
it('MUST NOT register an expired invite', async () =>
|
||||||
verifyRejectedInvite({code: 'code', exp: new Date(), issuer: 'Mocha'}, 'Invite expired.')
|
verifyRejectedInvite({code: 'code', expires: new Date(), issuer: 'Mocha'}, 'Invite expired.')
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ describe('Accounts', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Uploads', () => {
|
describe('Uploading', () => {
|
||||||
beforeEach(async () => util.clearDatabase());
|
beforeEach(async () => util.clearDatabase());
|
||||||
|
|
||||||
describe('/POST upload', () => {
|
describe('/POST upload', () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user