mirror of
https://github.com/Foltik/Shimapan
synced 2025-01-05 15:58:03 -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
|
||||
},
|
||||
|
||||
exp: {
|
||||
expires: {
|
||||
type: Date,
|
||||
default: null
|
||||
}
|
||||
|
@ -29,6 +29,11 @@ var UserSchema = mongoose.Schema({
|
||||
default: 0
|
||||
},
|
||||
|
||||
inviteCount: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
|
||||
date: {
|
||||
type: Date,
|
||||
default: Date.now
|
||||
|
@ -55,7 +55,7 @@ async function validateInvite(code) {
|
||||
if (invite.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: true, invite: invite};
|
||||
|
@ -30,7 +30,7 @@ after(() => {
|
||||
server.close();
|
||||
});
|
||||
|
||||
describe('Accounts', function() {
|
||||
describe('Authentication', function() {
|
||||
beforeEach(async () => util.clearDatabase());
|
||||
|
||||
describe('/POST register', () => {
|
||||
@ -87,7 +87,7 @@ describe('Accounts', function() {
|
||||
);
|
||||
|
||||
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());
|
||||
|
||||
describe('/POST upload', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user