Skip to content

Commit

Permalink
account creation tracks email
Browse files Browse the repository at this point in the history
  • Loading branch information
bryngo committed Jun 30, 2018
1 parent 6ab415e commit 1fc43ee
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 43 deletions.
3 changes: 2 additions & 1 deletion models/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const passportLocalMongoose = require('passport-local-mongoose');
const Account = new Schema({
username: String,
password: String,
permission: Number
permission: Number,
email: String
// -- permissions --
// 0 = normie
// 1 = all-powerful admin (Bryan)
Expand Down
7 changes: 0 additions & 7 deletions public/js/index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@

function wallsubmit() {

console.log("Submitting...");
var name = $('#name').val().trim();
var email = $('#email').val().trim();
var message = $('#message').val().trim();

console.log("Name: " + name);
console.log("email: " + email);
console.log("message: " + message);

// make sure all the fields are fields are filled out
if (name != '' && email != '' && message != '') {

console.log("All fields are good! Uploading to database");

// call the submit function
$.ajax({
type: "POST",
Expand Down
3 changes: 0 additions & 3 deletions routes/admin_queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ var insertAdmin = function(info, db, callback) {
assert.equal(err, null);
assert.equal(1, result.result.n);
assert.equal(1, result.ops.length);
console.log("Inserted 1 admin into the collection");
callback(result);
});
};
Expand Down Expand Up @@ -50,8 +49,6 @@ var filterAdmins = function(condition, db, callback) {
// Find some documents
collection.find(condition).toArray(function(err, docs) {
assert.equal(err, null);
console.log("Found specific event(s) with condition " + JSON.stringify(condition, null, 2));
console.log(docs);
callback(docs);
});
};
Expand Down
2 changes: 1 addition & 1 deletion routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ router.get('/register', function(req, res) {
});

router.post('/register', (req, res, next) => {
Account.register(new Account({ username : req.body.username, permission : 0 }), req.body.password, (err, account) => {
Account.register(new Account({ username : req.body.username, permission : 0, email: req.body.email}), req.body.password, (err, account) => {
if (err) {
return res.render('register', { error : err.message });
}
Expand Down
5 changes: 0 additions & 5 deletions routes/keyqueries.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var insertKey = function(info, db, callback) {
assert.equal(err, null);
assert.equal(1, result.result.n);
assert.equal(1, result.ops.length);
console.log("Inserted 1 keys into the chest");
callback(result);
});
};
Expand Down Expand Up @@ -54,8 +53,6 @@ var filterKeys = function(condition, db, callback) {
// Find some documents
collection.find(condition).toArray(function(err, docs) {
assert.equal(err, null);
console.log("Found specific event(s) with condition " + JSON.stringify(condition, null, 2));
console.log(docs);
callback(docs);
});
};
Expand Down Expand Up @@ -84,8 +81,6 @@ var findAllKeys = function(db, callback) {

collection.find({}).toArray(function(err, docs) {
assert.equal(err, null);
console.log("All of the keys: \n");
console.log(docs);
callback(docs);
});
};
Expand Down
3 changes: 0 additions & 3 deletions routes/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ var insertKey = function(db, callback) {
assert.equal(err, null);
assert.equal(1, result.result.n);
assert.equal(1, result.ops.length);
console.log("Inserted 1 key into collection chest");
callback(result);
});
};
Expand All @@ -50,8 +49,6 @@ var findAllKeys = function(db, callback) {

collection.find({}).toArray(function(err, docs) {
assert.equal(err, null);
console.log("All of the keys: \n");
console.log(docs);
callback(docs);
});
};
Expand Down
5 changes: 0 additions & 5 deletions routes/wallpostqueries.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ var insertWallPost = function(info, db, callback) {
assert.equal(err, null);
assert.equal(1, result.result.n);
assert.equal(1, result.ops.length);
console.log("Inserted 1 post into the wall posts");
callback(result);
});
};
Expand Down Expand Up @@ -50,8 +49,6 @@ var filterWallPosts = function(condition, db, callback) {
// Find some documents
collection.find(condition).toArray(function(err, docs) {
assert.equal(err, null);
console.log("Found specific posts(s) with condition " + JSON.stringify(condition, null, 2));
console.log(docs);
callback(docs);
});
};
Expand Down Expand Up @@ -80,8 +77,6 @@ var findAllWallPosts = function(db, callback) {

collection.find({}).toArray(function(err, docs) {
assert.equal(err, null);
console.log("All of the wall posts: \n");
console.log(docs);
callback(docs);
});
};
Expand Down
16 changes: 1 addition & 15 deletions views/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ html
.content
h1 Hi! I'm Bryan.
p.major
| Incoming Software Engineering Intern '18 @#{' '}
a(href='https://www.coursehero.com') Course Hero
| and an undergraduate Computer Science & Engineering Major, Statistics Minor @#{' '}
a(href='https://www.ucdavis.edu') UC Davis
| .
ul.actions.vertical
li
a.button.big.wide.smooth-scroll-middle(href='#first') Get to know me
Expand Down Expand Up @@ -75,10 +70,6 @@ html
section#first.spotlight.style1.orient-right.invert.content-align-left.image-position-center.onscroll-image-fade-in
.content
h2 Projects & More
p
| I took my first #{' '}
a(href='http://www.cs.ucdavis.edu/blog/ecs-30-programming-problem-solving/') computer science course
| after coming to UCD. 3 years later, and I've learned a lot. Continue on to learn about my experiences, projects, and much more!
ul.actions.vertical
li
a.button(href='#') ./read.sh
Expand All @@ -88,8 +79,6 @@ html
section.spotlight.style1.orient-left.content-align-left.image-position-center.onscroll-image-fade-in
.content
h2 Photography
p
| When I'm not programming, I'm taking pictures. This is my creative outlet, and I want to keep investing my time into it (I recommend everyone to have a creative outlet). Check out some of my work.
ul.actions.vertical
li
a.button(href='#') TFP?
Expand All @@ -99,7 +88,6 @@ html
section.spotlight.style1.orient-right.invert.content-align-left.image-position-center.onscroll-image-fade-in
.content
h2 Blog
p Here, you'll find my thoughts on life, food, and more!
ul.actions.vertical
li
a.button(href='blog')
Expand All @@ -125,16 +113,14 @@ html
.inner
h2 Message Wall
p
| Leave a friendly message below! Give suggestions, ask a question, or just say hi! All messages will be public, and any rude ones will be removed :).
| Leave a friendly message below! Give suggestions, ask a question, or just say hi!
.items.style1.medium.onscroll-fade-in

/// TODO: Limit the number of posts that can appear
- index = 0
each post in wallposts
- var poster = post['name'];
- var message = post['message'];
- console.log("Poster is: " + poster);
- console.log("Message is: " + message);
section
span.icon.style2.major.fa-diamond
h3 #{poster} says...
Expand Down
7 changes: 4 additions & 3 deletions views/register.jade
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ extends layout
block content
.container
h1 Register Page
p.lead Say something worthwhile here.
p.lead Your account will be safe with me (via Express & Passport)
br
form(role='form', action="/register",method="post", style='max-width: 300px;')
.form-group
input.form-control(type='text', name="username", placeholder='Enter Username')
.form-group
input.form-control(type='password', name="password", placeholder='Password')
input.form-control(type='password', name="password", placeholder='Password')
.form-group
input.form-control(type='text', name="email", placeholder='Enter Email')
button.btn.btn-default(type='submit') Submit
 
a(href='/')
button.btn.btn-primary(type="button") Cancel

0 comments on commit 1fc43ee

Please sign in to comment.