-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge Secure into Stable Removed insecure package, resolved all access violations See merge request !11
- Loading branch information
Showing
5 changed files
with
94 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,6 @@ [email protected] # Enable ECMAScript2015+ syntax in app code | |
[email protected] # Server-side component of the `meteor shell` command | ||
|
||
[email protected] # Publish all data to the clients (for prototyping) | ||
[email protected] # Allow all DB writes from clients (for prototyping) | ||
iron:router | ||
[email protected] | ||
[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,6 @@ [email protected] | |
[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
iron:[email protected] | ||
iron:[email protected] | ||
iron:[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,74 @@ | ||
// Import and initialize database | ||
|
||
import { Meteor } from 'meteor/meteor'; | ||
import { Mongo } from 'meteor/mongo'; | ||
|
||
export const Tickets = new Mongo.Collection('tickets'); | ||
|
||
Meteor.methods({ | ||
'tickets.insert'( //secure method for insertion - take all fields from client | ||
namein, | ||
rpiemail, | ||
altemail, | ||
phonein, | ||
issuetype, | ||
priority, | ||
summary, | ||
description, | ||
youremail, | ||
number, | ||
status, | ||
comments) { | ||
// Make sure the user is logged in before inserting a task | ||
if (!this.userId) { | ||
throw new Meteor.Error('not-authorized'); | ||
} | ||
Tickets.insert({ //actually insert | ||
namein, | ||
rpiemail, | ||
altemail, | ||
phonein, | ||
issuetype, | ||
priority, | ||
summary, | ||
description, | ||
youremail, | ||
number, | ||
status, | ||
comments, | ||
createdAt: new Date(), | ||
}); | ||
}, | ||
'tickets.comment'(numtofind, body, author) { | ||
const ticket = Tickets.findOne({ number: numtofind }); // get the actual ticket | ||
const arro = ticket.comments; //get the existing comments | ||
const time = new Date(); //current time | ||
let arrnew = [{}]; | ||
if (typeof (arro) === 'undefined') { //if no existing comments | ||
arrnew = [{ author, body, time }]; //compose new comment | ||
} else { //there are existing comments | ||
arrnew = arro; //copy old array | ||
arrnew.push({ author, body, time }); //push new comment to array | ||
} | ||
Tickets.update({ _id: ticket._id }, { $set: { comments: arrnew } }); //update comments array to new comments array | ||
}, | ||
'tickets.resolve'(numtofind, body, open) { //function to resolve or reopen a ticket | ||
const ticket = Tickets.findOne({ number: numtofind }); //find ticket | ||
const arro = ticket.comments; //get existing comments | ||
const author = 'System'; //these comments are authored by System | ||
const time = new Date(); //current time | ||
let arrnew = [{}]; | ||
if (typeof (arro) === 'undefined') { //if no existing comments | ||
arrnew = [{ author, body, time }]; //compose new comment | ||
} else { //else comments already exist | ||
arrnew = arro; //copy comments | ||
arrnew.push({ author, body, time }); //add new comment to array | ||
} | ||
Tickets.update({ _id: ticket._id }, { $set: { comments: arrnew } }); //update comments array with new one | ||
if (open) { //if reopening | ||
Tickets.update({ _id: ticket._id }, { $set: { status: true } }); //set status to open | ||
} else { //if resolving | ||
Tickets.update({ _id: ticket._id }, { $set: { status: false } }); //set status to resolved | ||
} | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!-- This template handles invalid routes --> | ||
<!-- Phrasing sourced from Tumblr --> | ||
|
||
<template name="404"> | ||
<div class="container"> | ||
<div class="text-center"> | ||
<h1>There's nothing here.</h1> | ||
<p>Whatever you were looking for doesn't currently exist at this address. Unless you were looking for this error page, in which case: Congrats! You totally found it.<br /> <br /> Click <a href='/'>here</a> to return to the homepage.</p> | ||
</div> | ||
</div> | ||
</template> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters