Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4bbcf69
Code shift to node
tanishk818 Mar 29, 2022
1c41337
Authentication enabled
tanishk818 Apr 6, 2022
a5dfc7f
admin
tanishk818 Apr 13, 2022
fec5269
feedback and faq models added and some cod refactoring
rohitbhati-rb Apr 14, 2022
42a9897
Forgot password features added
tanishk818 Apr 14, 2022
19897a9
forgot password added
tanishk818 Apr 14, 2022
c1eef76
new files added for frontend
rohitbhati-rb Apr 14, 2022
742c1cf
Level backend fixed and New Levels Added
tanishk818 Apr 16, 2022
8edf83e
forgot password complete flow done
tanishk818 Apr 24, 2022
0faec15
levels page and navbar ui completed
rohitbhati-rb May 1, 2022
e34e423
arrow keys working codes changed
rohitbhati-rb May 1, 2022
12f0c68
Level 1 and 2 completed
rohitbhati-rb May 1, 2022
8f46768
5 levels created and some ui improvements
rohitbhati-rb May 1, 2022
90f9104
change password added
tanishk818 May 1, 2022
4e2dead
expiration limit set to 10
tanishk818 May 2, 2022
799f319
about page added
rohitbhati-rb May 2, 2022
7719169
how to play page was added
rohitbhati-rb May 2, 2022
bdda758
feedback form ui completed
rohitbhati-rb May 2, 2022
e4a3f7d
admin page and login page ui improved
rohitbhati-rb May 2, 2022
993a619
faq page added
rohitbhati-rb May 2, 2022
5febe78
levels added and instructions colored
pulkitm May 3, 2022
ceb32ed
feedback, faq ui added and backend completed and created new admin pages
rohitbhati-rb May 3, 2022
6f14945
user model changed name included
pulkitm May 3, 2022
8295073
minor styling
pulkitm May 3, 2022
0e71761
change pass forgot pass
pulkitm May 3, 2022
d866585
levels added back
pulkitm May 3, 2022
60e5698
showing name in profile and admin page
pulkitm May 4, 2022
6202b1f
Remove duplicate POST login route and Added nessecary error flash mes…
tanishk818 May 4, 2022
ed57a10
accordian bug fixed
rohitbhati-rb May 4, 2022
334b753
admin portal designs completed
rohitbhati-rb May 4, 2022
52573c4
Level Data seperated from home.js
rohitbhati-rb May 4, 2022
a810ee5
win-loss popover design fix and background click disable
pulkitm May 5, 2022
f5b0688
leve image added and flash messages improved
pulkitm May 5, 2022
744a25d
added env file
rohitbhati-rb May 8, 2022
c8aab07
Update README.md
Purvang-Acharya May 8, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 130 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# LearningLoop: A platform for kids to understand programming in the form of game!!
## This main focus of our project is to get our users acquainted with code reading. After using our application users will have good practice on how a computer reads some code. It will be a useful skill when discovering code written by other people. It will be an essential skill while writing your own code too, having in mind how the computer will understand it, users will make less bugs, having been in the reader’s position, users will care about writing clearer code, with meaningful naming and careful spacing. ##
15 changes: 15 additions & 0 deletions Schema.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const Joi = require('joi');

module.exports.userSchema = Joi.object({
name: Joi.string().min(1).required(),
username: Joi.string().min(1).required(),
password: Joi.string().min(6).required()

});


module.exports.LoginSchema = Joi.object({
email: Joi.string().min(6).required(),
password: Joi.string().min(6).required()

});
75 changes: 75 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
if(process.env.NODE_ENV === 'production'){
require('dotenv').config();
}
const express = require('express');
const app = express()
const path = require('path');
const mongoose = require('mongoose');
const session = require('express-session');
const flash = require('connect-flash');
const passport = require('passport');
const LocalStrategy = require('passport-local');

const User = require('./models/user');
const home = require('./routes/home')
const lev = require('./routes/lev')

const database = process.env.DB_URL || 'mongodb://localhost/auth_demo_app';

// mongoose.connect('mongodb://localhost/auth_demo_app');
// mongoose.connect('mongodb+srv://rohit:TOZWAv6nyZ8LmfTo@cluster0.zalme.mongodb.net/myFirstDatabase?retryWrites=true&w=majority');
mongoose.connect(database);

const db = mongoose.connection;
db.on("error", console.error.bind(console, "connection error:"));
db.once("open", () => {
console.log("Database connected");
});




app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, 'views'))
app.use(express.static(__dirname + '/public'));

const sessConfig = {
secret: 'abetterone',
resave: false,
saveUninitialized: true,
name: 'cookie_name',
cookie: {
httpOnly: true,
expires: Date.now() + 1000 * 60 * 60 * 24 * 7,
maxAge: 1000 * 60 * 60 * 24 * 7
}
}
app.use(session(sessConfig));

app.use(express.urlencoded({ extended: true }));
app.use(express.static(path.join(__dirname, 'public')))

app.use(flash());

app.use(passport.initialize());
app.use(passport.session());

passport.use(new LocalStrategy(User.authenticate()));

passport.serializeUser(User.serializeUser());
passport.deserializeUser(User.deserializeUser());
app.use((req, res, next) => {
res.locals.currentUser = req.user;
res.locals.success = req.flash('success');
res.locals.error = req.flash('error');
next();
})

app.use('/', home);
app.use('/lev', lev);


app.listen(3000, () => {
console.log('Serving on port 3000')
})

126 changes: 0 additions & 126 deletions arrow.css

This file was deleted.

31 changes: 31 additions & 0 deletions crypto.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const crypto = require('crypto');

const algorithm = 'aes-256-ctr';
const secretKey = 'vOVH6sdmpNWjRRIqCc7rdxs01lwHzfr3';
const iv = crypto.randomBytes(16);

const encrypt = (text) => {

const cipher = crypto.createCipheriv(algorithm, secretKey, iv);

const encrypted = Buffer.concat([cipher.update(text), cipher.final()]);

return {
iv: iv.toString('hex'),
content: encrypted.toString('hex')
};
};

const decrypt = (hash) => {

const decipher = crypto.createDecipheriv(algorithm, secretKey, Buffer.from(hash.iv, 'hex'));

const decrpyted = Buffer.concat([decipher.update(Buffer.from(hash.content, 'hex')), decipher.final()]);

return decrpyted.toString();
};

module.exports = {
encrypt,
decrypt
};
Loading