1
0
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:
Jack Foltz 2018-07-27 14:23:23 -04:00
parent 230f9c2415
commit c9e250a68e
Signed by: foltik
GPG Key ID: 303F88F996E95541
4 changed files with 10 additions and 5 deletions

View File

@ -32,7 +32,7 @@ var InviteSchema = mongoose.Schema({
default: null
},
exp: {
expires: {
type: Date,
default: null
}

View File

@ -29,6 +29,11 @@ var UserSchema = mongoose.Schema({
default: 0
},
inviteCount: {
type: Number,
default: 0
},
date: {
type: Date,
default: Date.now

View File

@ -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};

View File

@ -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', () => {