├── Note_rn ├── screens │ ├── Community.js │ ├── Subsciption.js │ ├── Home.js │ ├── Cs.js │ ├── Py.js │ ├── ChatScreen.js │ ├── Welcome.js │ ├── Login.js │ └── Signin.js ├── components │ ├── Custom_card.js │ ├── Button.js │ ├── Categories.js │ └── Card.js ├── link.txt ├── assets │ ├── aa.gif │ ├── nn.mp4 │ ├── aaa.gif │ ├── icon.png │ ├── favicon.png │ ├── splash.png │ ├── welcome.png │ ├── adaptive-icon.png │ ├── loading.json │ └── login_animation.json ├── babel.config.js ├── .gitignore ├── app.json ├── fireconfig.js ├── package.json └── App.js ├── backend_rn ├── .gitignore ├── vercel.json ├── controllers │ ├── note │ │ ├── all.js │ │ ├── all2.js │ │ ├── new.js │ │ └── newcs.js │ └── auth │ │ ├── id.js │ │ ├── payment.js │ │ ├── n-password.js │ │ ├── login.js │ │ ├── signin.js │ │ └── forgot.js ├── db.js ├── models │ ├── note.js │ ├── note2.js │ └── User.js ├── router │ ├── Note.js │ └── auth.js ├── index.js ├── package.json ├── middleware │ └── fetchUser.js └── yarn.lock └── README.md /Note_rn/screens/Community.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Note_rn/components/Custom_card.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Note_rn/screens/Subsciption.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /backend_rn/.gitignore: -------------------------------------------------------------------------------- 1 | .vercel 2 | /node_modules -------------------------------------------------------------------------------- /Note_rn/link.txt: -------------------------------------------------------------------------------- 1 | https://backendrn-production.up.railway.app/api/user/login -------------------------------------------------------------------------------- /Note_rn/assets/aa.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/GENCO/HEAD/Note_rn/assets/aa.gif -------------------------------------------------------------------------------- /Note_rn/assets/nn.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/GENCO/HEAD/Note_rn/assets/nn.mp4 -------------------------------------------------------------------------------- /backend_rn/vercel.json: -------------------------------------------------------------------------------- 1 | { "version": 2, "rewrites": [{ "source": "/(.*)", "destination": "/" }] } -------------------------------------------------------------------------------- /Note_rn/assets/aaa.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/GENCO/HEAD/Note_rn/assets/aaa.gif -------------------------------------------------------------------------------- /Note_rn/assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/GENCO/HEAD/Note_rn/assets/icon.png -------------------------------------------------------------------------------- /Note_rn/assets/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/GENCO/HEAD/Note_rn/assets/favicon.png -------------------------------------------------------------------------------- /Note_rn/assets/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/GENCO/HEAD/Note_rn/assets/splash.png -------------------------------------------------------------------------------- /Note_rn/assets/welcome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/GENCO/HEAD/Note_rn/assets/welcome.png -------------------------------------------------------------------------------- /Note_rn/assets/adaptive-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/GENCO/HEAD/Note_rn/assets/adaptive-icon.png -------------------------------------------------------------------------------- /Note_rn/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function(api) { 2 | api.cache(true); 3 | return { 4 | presets: ['babel-preset-expo'], 5 | }; 6 | }; 7 | -------------------------------------------------------------------------------- /backend_rn/controllers/note/all.js: -------------------------------------------------------------------------------- 1 | const PyNote = require('../../models/note'); 2 | 3 | const get = async (req, res) => { 4 | try { 5 | const note = await PyNote.find({}); 6 | res.json(note); 7 | ``; 8 | } catch (error) { 9 | console.error(error.message); 10 | res.status(500).send("Internal Server Error"); 11 | } 12 | } 13 | module.exports = get; -------------------------------------------------------------------------------- /backend_rn/controllers/note/all2.js: -------------------------------------------------------------------------------- 1 | const CssNote = require('../../models/note2'); 2 | 3 | const get2 = async (req, res) => { 4 | try { 5 | const note = await CssNote.find({}); 6 | res.json(note); 7 | ``; 8 | } catch (error) { 9 | console.error(error.message); 10 | res.status(500).send("Internal Server Error"); 11 | } 12 | } 13 | module.exports = get2; -------------------------------------------------------------------------------- /backend_rn/db.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const MONGO_URI = `mongodb+srv://Aditya:adpandey@cluster0.h40tx.mongodb.net/Note_rn?retryWrites=true&w=majority`; 4 | 5 | 6 | mongoose.connect(MONGO_URI, { 7 | useNewUrlParser: true, 8 | useUnifiedTopology: true, 9 | }) 10 | .then(() => { 11 | console.log('Connected to MongoDB'); 12 | }) 13 | .catch((error) => { 14 | console.error('Error connecting to MongoDB:', error); 15 | }); -------------------------------------------------------------------------------- /backend_rn/controllers/auth/id.js: -------------------------------------------------------------------------------- 1 | const User = require("../../models/User"); 2 | 3 | 4 | const id = async(req, res) => { 5 | try { 6 | let userId = req.user.id; 7 | const user = await User.findById(userId).select("-password"); 8 | // const user1 = user.("-resetToken") 9 | // const user2 = user1.select("-expireToken") 10 | res.send(user); 11 | } catch (error) { 12 | console.log(error.message); 13 | res.status(500).send("Enternal sever error"); 14 | } 15 | } 16 | 17 | module.exports = id; -------------------------------------------------------------------------------- /backend_rn/models/note.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const { Schema } = mongoose; 3 | 4 | const NoteSchema = new Schema({ 5 | user: { 6 | type: mongoose.Schema.Types.ObjectId, 7 | ref: 'user', 8 | }, 9 | title: { 10 | type: String, 11 | required: true, 12 | 13 | }, 14 | content: { 15 | type: String, 16 | required: true, 17 | 18 | } 19 | 20 | 21 | 22 | }) 23 | const PyNote = mongoose.model('PyNote', NoteSchema); 24 | module.exports = PyNote; -------------------------------------------------------------------------------- /backend_rn/models/note2.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const { Schema } = mongoose; 3 | 4 | const NoteSchema = new Schema({ 5 | user: { 6 | type: mongoose.Schema.Types.ObjectId, 7 | ref: 'user', 8 | }, 9 | title: { 10 | type: String, 11 | required: true, 12 | 13 | }, 14 | content: { 15 | type: String, 16 | required: true, 17 | 18 | } 19 | 20 | 21 | 22 | }) 23 | const CssNote = mongoose.model('CssNote', NoteSchema); 24 | module.exports = CssNote; -------------------------------------------------------------------------------- /Note_rn/.gitignore: -------------------------------------------------------------------------------- 1 | # Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files 2 | 3 | # dependencies 4 | node_modules/ 5 | 6 | # Expo 7 | .expo/ 8 | dist/ 9 | web-build/ 10 | 11 | # Native 12 | *.orig.* 13 | *.jks 14 | *.p8 15 | *.p12 16 | *.key 17 | *.mobileprovision 18 | 19 | # Metro 20 | .metro-health-check* 21 | 22 | # debug 23 | npm-debug.* 24 | yarn-debug.* 25 | yarn-error.* 26 | 27 | # macOS 28 | .DS_Store 29 | *.pem 30 | 31 | # local env files 32 | .env*.local 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | -------------------------------------------------------------------------------- /backend_rn/router/Note.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const router = express.Router(); 3 | const { body, validationResult } = require("express-validator"); 4 | const get = require("../controllers/note/all"); 5 | const add = require("../controllers/note/new"); 6 | const add2 = require("../controllers/note/newcs"); 7 | const get2 = require("../controllers/note/all2"); 8 | 9 | router.get("/fetchallpy",get ); 10 | router.get("/fetchallcss",get2 ); 11 | 12 | 13 | 14 | router.post("/addpy", add); 15 | router.post("/addcs", add2); 16 | 17 | 18 | module.exports = router; -------------------------------------------------------------------------------- /backend_rn/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const app = express(); 3 | var cors = require('cors'); 4 | 5 | require('./db') 6 | 7 | const PORT = process.env.PORT || 5000; 8 | 9 | app.use(express.json()); 10 | app.use(cors()) 11 | 12 | // Avialable Route 13 | app.get('/', (req, res) => { 14 | res.send('Hello Owner ') 15 | }) 16 | // app.use('/api/auth',require('./routes/auth')) 17 | 18 | app.use('/api/note', require('./router/Note')) 19 | app.use('/api/user', require('./router/auth')) 20 | 21 | app.listen(PORT, () => { 22 | console.log(`Server is listening on port ${PORT}`); 23 | }); -------------------------------------------------------------------------------- /backend_rn/controllers/auth/payment.js: -------------------------------------------------------------------------------- 1 | const User = require('../../models/User'); 2 | 3 | const paid = async(req, res) => { 4 | try { 5 | 6 | let userId = req.user.id; 7 | const user = await User.findByIdAndUpdate(userId, { last_payment: new Date(), next_payment: new Date(Date.now() + 3600000*24*30) }); 8 | res.json({ message: "Payment Successful" }); 9 | 10 | 11 | 12 | 13 | } catch (error) { 14 | console.log(error.message); 15 | res.status(500).send("Enternal sever error"); 16 | } 17 | } 18 | 19 | module.exports = paid; -------------------------------------------------------------------------------- /backend_rn/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "backend-agh", 3 | "version": "1.0.0", 4 | "description": "backend for the website and also for the booking purpose", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "nodemon index.js" 8 | }, 9 | "author": "Aditya Pandey", 10 | "license": "ISC", 11 | "dependencies": { 12 | "bcryptjs": "^2.4.3", 13 | "cors": "^2.8.5", 14 | "express": "^4.19.2", 15 | "express-validator": "^7.2.0", 16 | "jsonwebtoken": "^9.0.2", 17 | "mongoose": "^8.5.3", 18 | "nodemailer": "^6.9.14" 19 | }, 20 | "devDependencies": { 21 | "nodemon": "^3.1.4" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Note_rn/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "expo": { 3 | "name": "notessss", 4 | "slug": "notessss", 5 | "version": "1.0.0", 6 | "orientation": "portrait", 7 | "icon": "./assets/icon.png", 8 | "userInterfaceStyle": "dark", 9 | "splash": { 10 | "image": "./assets/splash.png", 11 | "resizeMode": "contain", 12 | "backgroundColor": "#A9A9A9" 13 | }, 14 | "ios": { 15 | "supportsTablet": true 16 | }, 17 | "android": { 18 | "adaptiveIcon": { 19 | "foregroundImage": "./assets/adaptive-icon.png", 20 | "backgroundColor": "#A9A9A9" 21 | } 22 | }, 23 | "web": { 24 | "favicon": "./assets/favicon.png" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /backend_rn/middleware/fetchUser.js: -------------------------------------------------------------------------------- 1 | const jwt = require("jsonwebtoken"); 2 | const JWT_SECRECT = "Aditya"; 3 | 4 | const fetchUser =(req, res, next) =>{ 5 | // get the user from jwt server and id to req object 6 | const token = req.header('auth-token'); 7 | if (!token){ 8 | res.status(401).send({error:"Please authenticate using a valid token"}) 9 | } 10 | try { 11 | const data = jwt.verify(token, JWT_SECRECT); 12 | req.user = data.user; 13 | // res.json(data); 14 | // req.send(req.user); 15 | next() 16 | } catch (error) { 17 | res.status(401).send({error:"Please authenticate using a valid token"}) 18 | } 19 | 20 | } 21 | 22 | module.exports = fetchUser; -------------------------------------------------------------------------------- /Note_rn/fireconfig.js: -------------------------------------------------------------------------------- 1 | import firebase from 'firebase/app'; 2 | import 'firebase/auth'; 3 | import 'firebase/firestore'; 4 | import 'firebase/storage'; 5 | 6 | const firebaseConfig = { 7 | apiKey: "AIzaSyCoHtusUOKlicpu3EqxBPSKn47hM9qEFR4", 8 | authDomain: "project-5d1cd.firebaseapp.com", 9 | projectId: "project-5d1cd", 10 | storageBucket: "project-5d1cd.appspot.com", 11 | messagingSenderId: "1069248766217", 12 | appId: "1:1069248766217:web:86d9bc0239b1d5d46173d8", 13 | }; 14 | 15 | if (!firebase.apps.length) { 16 | firebase.initializeApp(firebaseConfig); 17 | } 18 | 19 | const auth = firebase.auth(); 20 | const db = firebase.firestore(); 21 | const storage = firebase.storage(); 22 | 23 | export { firebase, auth, db, storage }; 24 | -------------------------------------------------------------------------------- /Note_rn/components/Button.js: -------------------------------------------------------------------------------- 1 | // CustomButton.js 2 | import React from 'react'; 3 | import { TouchableOpacity, Text, StyleSheet } from 'react-native'; 4 | 5 | export default function Button({ title, onPress, color = '#007BFF', style = {}, textStyle = {} }) { 6 | return ( 7 | 11 | {title} 12 | 13 | ); 14 | } 15 | 16 | const styles = StyleSheet.create({ 17 | button: { 18 | paddingVertical: 10, 19 | paddingHorizontal: 20, 20 | borderRadius: 5, 21 | alignItems: 'center', 22 | justifyContent: 'center', 23 | }, 24 | buttonText: { 25 | color: '#fff', 26 | fontSize: 16, 27 | fontWeight: 'bold', 28 | }, 29 | }); 30 | -------------------------------------------------------------------------------- /backend_rn/controllers/auth/n-password.js: -------------------------------------------------------------------------------- 1 | const bcrypt = require('bcryptjs') 2 | const User = require("../../models/User"); 3 | 4 | 5 | const newpass = async (req, res) => { 6 | const newPassword = req.body.password 7 | const sentToken = req.params.token 8 | await User.findOne({resetToken:sentToken, expireToken:{ $gt:Date.now()}}) 9 | .then(user=>{ 10 | if(!user){ 11 | return res.status(422).json({error:"Try again session expired"}) 12 | } 13 | bcrypt.hash(newPassword,12).then(hashedpassword=>{ 14 | user.password = hashedpassword 15 | user.resetToken = undefined 16 | user.expireToken = undefined 17 | user.save().then((saveduser)=>{ 18 | res.json({message:"password updated success"}) 19 | }) 20 | }) 21 | }).catch(err=>{ 22 | console.log(err) 23 | }) 24 | } 25 | 26 | module.exports = newpass; -------------------------------------------------------------------------------- /backend_rn/controllers/note/new.js: -------------------------------------------------------------------------------- 1 | const PyNote = require('../../models/note'); 2 | 3 | const add = async (req, res) => { 4 | try { 5 | const { 6 | id, 7 | title, 8 | content, 9 | category, 10 | // user 11 | 12 | } = req.body; 13 | 14 | // If there are errors, return Bad request and the errors 15 | // const errors = validationResult(req); 16 | // if (!errors.isEmpty()) { 17 | // return res.status(400).json({ errors: errors.array() }); 18 | // } 19 | const note = new PyNote({ 20 | id, 21 | title, 22 | content, 23 | category, 24 | // user: req.user.id, 25 | // user: req.user._id, 26 | }); 27 | const savedNote = await note.save(); 28 | 29 | // res.json(savedNote); 30 | var json = JSON.stringify(savedNote); 31 | 32 | res.send(json); 33 | 34 | } catch (error) { 35 | console.error(error.message); 36 | res.status(500).send("Internal Server Error"); 37 | } 38 | } 39 | 40 | module.exports = add; -------------------------------------------------------------------------------- /backend_rn/controllers/note/newcs.js: -------------------------------------------------------------------------------- 1 | const CssNote = require('../../models/note2'); 2 | 3 | const add2 = async (req, res) => { 4 | try { 5 | const { 6 | id, 7 | title, 8 | content, 9 | category, 10 | // user 11 | 12 | } = req.body; 13 | 14 | // If there are errors, return Bad request and the errors 15 | // const errors = validationResult(req); 16 | // if (!errors.isEmpty()) { 17 | // return res.status(400).json({ errors: errors.array() }); 18 | // } 19 | const note = new CssNote({ 20 | id, 21 | title, 22 | content, 23 | category, 24 | // user: req.user.id, 25 | // user: req.user._id, 26 | }); 27 | const savedNote = await note.save(); 28 | 29 | // res.json(savedNote); 30 | var json = JSON.stringify(savedNote); 31 | 32 | res.send(json); 33 | 34 | } catch (error) { 35 | console.error(error.message); 36 | res.status(500).send("Internal Server Error"); 37 | } 38 | } 39 | 40 | module.exports = add2; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | GENCO 2 | 3 | an application build using react-native, express, node js and MongoDb to help the students with learning through an integrated set of feautes ai supported tools. 4 | 5 | Frontend: 6 | 7 | Assets 8 | 9 | components 10 | 11 | - Button.js 12 | - Card.js 13 | - Categories.js 14 | - Custom_card.js 15 | 16 | Screens: 17 | 18 | - ChatScreen.js 19 | - Community.js 20 | - Cs.js 21 | - Home.js 22 | - Login.js 23 | - Py.js 24 | - Signin.js 25 | - Subsciption.js 26 | - Welcome.js 27 | 28 | - .gitignore - 29 | - App.js 30 | - app.json 31 | - babel.config.js 32 | - fireconfig.js 33 | - link.txt 34 | - package-lock.json 35 | - package.json 36 | 37 | Backend: 38 | 39 | Backend structure: 40 | 41 | controllers 42 | 43 | auth.js 44 | 45 | note.js 46 | 47 | middleware 48 | 49 | models 50 | 51 | user.js 52 | 53 | note.js 54 | 55 | router 56 | 57 | - .gitignore 58 | - db.js 59 | - index.js 60 | - package.json 61 | - vercel.json 62 | - yarn.lock 63 | 64 | `cd Note_rn` 65 | 66 | `npm i` 67 | 68 | `npm start` 69 | 70 | Similarly for Backend_rn 71 | 72 | `cd` Backend_rn 73 | 74 | `npm i` 75 | 76 | `npm test` 77 | -------------------------------------------------------------------------------- /Note_rn/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "notessss", 3 | "version": "1.0.0", 4 | "main": "expo/AppEntry.js", 5 | "scripts": { 6 | "start": "expo start", 7 | "android": "expo start --android", 8 | "ios": "expo start --ios", 9 | "web": "expo start --web" 10 | }, 11 | "dependencies": { 12 | "@react-native-google-signin/google-signin": "^12.2.1", 13 | "@react-navigation/drawer": "^6.7.2", 14 | "@react-navigation/native": "^6.1.18", 15 | "@react-navigation/stack": "^6.4.1", 16 | "expo": "~51.0.28", 17 | "expo-auth-session": "^5.5.2", 18 | "expo-image-picker": "^15.0.7", 19 | "expo-status-bar": "~1.12.1", 20 | "firebase": "^10.13.0", 21 | "lottie-ios": "^3.1.8", 22 | "lottie-react-native": "^6.7.2", 23 | "react": "18.2.0", 24 | "react-native": "0.74.5", 25 | "react-native-gifted-chat": "^2.6.0", 26 | "react-native-safe-area-context": "^4.10.9", 27 | "react-native-screens": "^3.34.0", 28 | "react-native-video": "^6.4.5", 29 | "uuid": "^10.0.0" 30 | }, 31 | "devDependencies": { 32 | "@babel/core": "^7.20.0" 33 | }, 34 | "private": true 35 | } 36 | -------------------------------------------------------------------------------- /backend_rn/models/User.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const { Schema } = mongoose; 3 | 4 | const UserSchema = new Schema({ 5 | name:{ 6 | type: 'string', 7 | required: true, 8 | unique: true 9 | }, 10 | img: { 11 | type: 'string', 12 | required: true, 13 | }, 14 | email: { 15 | type: 'string', 16 | required : true, 17 | unique : true, 18 | }, 19 | password:{ 20 | type: 'string', 21 | required : true, 22 | }, 23 | resetToken:{ 24 | type: 'string', 25 | default: null 26 | }, 27 | expireToken: { 28 | type: Date, 29 | default: null 30 | }, 31 | last_payment: { 32 | type: 'string', 33 | default: null, 34 | }, 35 | next_payment: { 36 | type: 'string', 37 | default: null, 38 | }, 39 | google_token: { 40 | type: 'string', 41 | default: null, 42 | }, 43 | date:{ 44 | type: Date, 45 | default: Date.now, 46 | } 47 | 48 | }) 49 | const User = mongoose.model('User',UserSchema); 50 | module.exports = User; -------------------------------------------------------------------------------- /backend_rn/controllers/auth/login.js: -------------------------------------------------------------------------------- 1 | const User = require("../../models/User"); 2 | const bcrypt = require("bcryptjs"); 3 | const jwt = require("jsonwebtoken"); 4 | const JWT_SECRECT = "Aditya"; 5 | 6 | const login = async (req, res) => { 7 | const { email, password } = req.body; 8 | try { 9 | let user = await User.findOne({ email }); 10 | if (!user) { 11 | return res 12 | .status(404) 13 | .json({ errors: "Please try to login with correct Credential" }); 14 | } 15 | 16 | const passwordCompare = await bcrypt.compare(password, user.password); 17 | if (!passwordCompare) { 18 | return res 19 | .status(404) 20 | .json({ errors: "Please try to login with correct Credential" }); 21 | } 22 | const data = { 23 | user: { 24 | id: user.id, 25 | }, 26 | }; 27 | let userId = data.user.id; 28 | const user1 = await User.findById(userId).select("-password"); 29 | const authtoken = jwt.sign(data, JWT_SECRECT); 30 | // console.log(jwtData) 31 | var success = true; 32 | res.json({ success,authtoken,img:user1.img,name:user1.name,id:data.user.id }); 33 | // res.json(data.user); 34 | } catch (error) { 35 | console.log(error.message); 36 | res.status(500).send("Enternal sever error"); 37 | } 38 | } 39 | 40 | module.exports = login; 41 | -------------------------------------------------------------------------------- /Note_rn/App.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { NavigationContainer } from '@react-navigation/native'; 3 | import { createStackNavigator } from '@react-navigation/stack'; 4 | import Home from './screens/Home'; 5 | import Login from './screens/Login'; 6 | import Card from './components/Card' 7 | import Categories from './components/Categories' 8 | import Signin from './screens/Signin'; 9 | import Welcome from './screens/Welcome'; 10 | // import ChatScreen from './screens/ChatScreen'; 11 | import Cs from './screens/Cs'; 12 | import Py from './screens/Py'; 13 | 14 | const Stack = createStackNavigator(); 15 | 16 | export default function App({navigation}) { 17 | return ( 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | {/* */} 26 | 27 | 28 | 29 | 30 | 31 | ); 32 | } 33 | -------------------------------------------------------------------------------- /backend_rn/controllers/auth/signin.js: -------------------------------------------------------------------------------- 1 | const User = require("../../models/User"); 2 | const bcrypt = require("bcryptjs"); 3 | const jwt = require("jsonwebtoken"); 4 | const JWT_SECRECT = "Aditya"; 5 | 6 | const loged = async (req, res) => { 7 | let user = await User.findOne({ email: req.body.email }); 8 | 9 | if (user) { 10 | return res 11 | .status(400) 12 | .json({ error: "Sorry a user with this email already exists." }); 13 | } 14 | let name = await User.findOne({ name: req.body.name }); 15 | if (name) { 16 | return res 17 | .status(400) 18 | .json({ error: "Sorry a user with this user-name already exists." }); 19 | } 20 | try { 21 | // slating 22 | password = req.body.password; 23 | const salt = await bcrypt.genSalt(10); 24 | nPass = await bcrypt.hash(password, salt); 25 | // adding to the database 26 | var seed = Math.floor(Math.random() * 5000) 27 | var img = `https://avatars.dicebear.com/api/human/${seed}.svg`; 28 | user = await User.create({ name: req.body.name, email: req.body.email, password: nPass, img: img, }); 29 | // to generate token 30 | const data = { 31 | user: { 32 | id: user.id, 33 | } 34 | } 35 | const token = jwt.sign(data, JWT_SECRECT); 36 | let success = true 37 | // sending the token 38 | res.json({ success, token, img, name: req.body.name}).status(200); 39 | } catch (error) { 40 | console.log(error); 41 | } 42 | } 43 | 44 | module.exports = loged; 45 | -------------------------------------------------------------------------------- /Note_rn/assets/loading.json: -------------------------------------------------------------------------------- 1 | { 2 | "v": "5.7.6", 3 | "fr": 30, 4 | "ip": 0, 5 | "op": 120, 6 | "w": 200, 7 | "h": 200, 8 | "nm": "loading_animation", 9 | "ddd": 0, 10 | "assets": [], 11 | "layers": [ 12 | { 13 | "ddd": 0, 14 | "ind": 0, 15 | "ty": 4, 16 | "nm": "Circle Layer", 17 | "sr": 1, 18 | "ks": { 19 | "o": { "a": 0, "k": 100, "ix": 11 }, 20 | "r": { "a": 1, "k": [ 21 | { "t": 0, "s": [0], "e": [360], "i": { "x": 0.5, "y": 0.5 }, "o": { "x": 0.5, "y": 0.5 } }, 22 | { "t": 120, "s": [360], "e": [0], "i": { "x": 0.5, "y": 0.5 }, "o": { "x": 0.5, "y": 0.5 } } 23 | ], "ix": 10 }, 24 | "p": { "a": 0, "k": [100, 100, 0], "ix": 2 }, 25 | "a": { "a": 0, "k": [100, 100, 0], "ix": 1 }, 26 | "s": { "a": 0, "k": [100, 100, 100], "ix": 6 } 27 | }, 28 | "ao": 0, 29 | "shapes": [ 30 | { 31 | "ty": "el", 32 | "p": { "a": 0, "k": [100, 100], "ix": 2 }, 33 | "s": { "a": 0, "k": [100, 100], "ix": 3 }, 34 | "nm": "Circle Shape", 35 | "mn": "ADBE Vector Shape - Ellipse", 36 | "hd": false 37 | }, 38 | { 39 | "ty": "st", 40 | "c": { "a": 0, "k": [1, 0, 0, 1], "ix": 3 }, 41 | "o": { "a": 0, "k": 100, "ix": 4 }, 42 | "w": { "a": 0, "k": 8, "ix": 5 }, 43 | "lc": 1, 44 | "lj": 1, 45 | "nm": "Stroke", 46 | "mn": "ADBE Vector Graphic - Stroke", 47 | "hd": false 48 | } 49 | ], 50 | "ip": 0, 51 | "op": 120, 52 | "st": 0, 53 | "bm": 0 54 | } 55 | ], 56 | "markers": [] 57 | } 58 | -------------------------------------------------------------------------------- /backend_rn/router/auth.js: -------------------------------------------------------------------------------- 1 | // importing the modules for the routes 2 | const express = require("express"); 3 | const router = express.Router(); 4 | // const crypto = require('crypto') 5 | const {body} = require("express-validator"); 6 | var fetchUser = require("../middleware/fetchUser"); 7 | // const User = require("../models/User"); 8 | 9 | // const jwt = require('jsonwebtoken') 10 | 11 | // requirement of the controllers 12 | const loged = require("../controllers/auth/signin"); 13 | const login = require("../controllers/auth/login"); 14 | const id = require("../controllers/auth/id"); 15 | const forget = require("../controllers/auth/forgot"); 16 | const newpass = require("../controllers/auth/n-password"); 17 | const paid = require("../controllers/auth/payment"); 18 | 19 | 20 | 21 | // this is to create a new user 22 | // using the loged controller 23 | router.post( 24 | "/signin", 25 | [ 26 | body("name", "Enter a valid Name").isLength({ min: 3 }), 27 | body("email", "Enter a valid Email").isEmail(), 28 | body("password", "Password must be at least 5 characters").isLength({min: 5,}),], 29 | loged 30 | ); 31 | 32 | // this is to login in the account 33 | // using the login controller 34 | router.post('/login', [ 35 | body("password", "Password Cannot be blank").exists(), 36 | body("email", "Enter a valid Email").isEmail(),], 37 | login 38 | ); 39 | 40 | // this is to get the user details 41 | // using the id controller 42 | router.get("/getuser", fetchUser, id); 43 | 44 | // this is to send the email to the user 45 | // using the forget controller 46 | router.post('/reset-password', forget); 47 | 48 | // this is to reset the password 49 | // using the newpass controller 50 | router.post('/new-password/:token', newpass) 51 | 52 | 53 | // this is to update the payment details 54 | 55 | router.post('/payment',fetchUser, paid) 56 | 57 | 58 | module.exports = router; 59 | -------------------------------------------------------------------------------- /backend_rn/controllers/auth/forgot.js: -------------------------------------------------------------------------------- 1 | const User = require("../../models/User"); 2 | const crypto = require("crypto"); 3 | const nodemailer = require('nodemailer') 4 | // let aws = require("@aws-sdk/client-ses"); 5 | // let { defaultProvider } = require("@aws-sdk/credential-provider-node"); 6 | // const sendgridTransport = require('nodemailer-sendgrid-transport') 7 | 8 | var transporter = nodemailer.createTransport({ 9 | service: 'gmail', 10 | auth: { 11 | user: 'adityapandeyadp@gmail.com', 12 | pass: 'jonyjony123' 13 | } 14 | }); 15 | 16 | // const ses = new aws.SES({ 17 | // apiVersion: "2010-12-01", 18 | // region: "us-east-1", 19 | // defaultProvider, 20 | // }); 21 | 22 | // // create Nodemailer SES transporter 23 | // let transporter = nodemailer.createTransport({ 24 | // SES: { ses, aws }, 25 | // }); 26 | 27 | const forget = async (req,res)=>{ 28 | crypto.randomBytes(32,(err,buffer)=>{ 29 | if(err){ 30 | console.log(err) 31 | } 32 | const token = buffer.toString("hex") 33 | User.findOne({email:req.body.email}) 34 | .then(user=>{ 35 | if(!user){ 36 | return res.status(422).json({error:"User dont exists with that email"}) 37 | } 38 | user.resetToken = token 39 | user.expireToken = Date.now() + 3600000 40 | const host = 'http://localhost:5000' 41 | user.save().then((result)=>{ 42 | transporter.sendMail({ 43 | to:user.email, 44 | from:"adityapandeyadp@gmail.com", 45 | subject:"password reset", 46 | html:` 47 |

You requested for password reset

48 |
click in this link to reset password
49 | ` 50 | }) 51 | res.json({message:"check your email"}) 52 | }) 53 | 54 | }) 55 | }) 56 | } 57 | 58 | module.exports = forget; -------------------------------------------------------------------------------- /Note_rn/components/Categories.js: -------------------------------------------------------------------------------- 1 | import { StyleSheet, Image, SafeAreaView, Dimensions, Text, View } from 'react-native'; 2 | import React from 'react'; 3 | import Button from './Button'; 4 | 5 | const { width, height } = Dimensions.get('window'); 6 | 7 | 8 | export default function Categories({ navigation }) { 9 | return ( 10 | 11 | 12 | 13 | {/* Welcome to The n-Notes App */} 14 | 15 |