updates
This commit is contained in:
parent
6a4a75b56f
commit
22f46999d3
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@ -8,7 +8,7 @@
|
||||
"name": "React",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"url": "http://localhost:3000",
|
||||
"url": "http://localhost:6969",
|
||||
"webRoot": "${workspaceRoot}/react-backend/client/src"
|
||||
},
|
||||
{
|
||||
@ -36,7 +36,7 @@
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"program": "${workspaceFolder}/lib/encrypt.js"
|
||||
"program": "${workspaceFolder}/lib/addAccounts.js"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,22 +1,69 @@
|
||||
import React, { Component } from 'react';
|
||||
import axios from 'axios';
|
||||
import './App.css';
|
||||
class App extends Component {
|
||||
state = { streams: [] }
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
fname: '',
|
||||
lname: '',
|
||||
streams: []
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
fetch('/getStreams')
|
||||
.then(res => res.json())
|
||||
.then(streams => this.setState({ streams }));
|
||||
}
|
||||
|
||||
|
||||
onChange = (e) => {
|
||||
/*
|
||||
Because we named the inputs to match their
|
||||
corresponding values in state, it's
|
||||
super easy to update the state
|
||||
*/
|
||||
this.setState({ [e.target.name]: e.target.value });
|
||||
}
|
||||
|
||||
onSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
// get our form data out of state
|
||||
const { fname, lname } = this.state;
|
||||
console.log({ fname, lname })
|
||||
}
|
||||
|
||||
render() {
|
||||
const { fname, lname } = this.state;
|
||||
return (
|
||||
<section class="container">
|
||||
<div class="left-half">
|
||||
<article>
|
||||
<h1>User Login</h1>
|
||||
<p>
|
||||
I am a user login
|
||||
<form onSubmit={this.onSubmit}>
|
||||
<p>UserName
|
||||
<input
|
||||
type="text"
|
||||
name="fname"
|
||||
value={fname}
|
||||
onChange={this.onChange}
|
||||
/>
|
||||
</p>
|
||||
<p>Password
|
||||
<input
|
||||
type="text"
|
||||
name="lname"
|
||||
value={lname}
|
||||
onChange={this.onChange}
|
||||
/>
|
||||
</p>
|
||||
<br />
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<div class="right-half">
|
||||
|
60
client/src/app2.js
Normal file
60
client/src/app2.js
Normal file
@ -0,0 +1,60 @@
|
||||
import React, { Component } from 'react';
|
||||
import axios from 'axios';
|
||||
|
||||
class UserForm extends Component {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
fname: '',
|
||||
lname: '',
|
||||
email: '',
|
||||
};
|
||||
}
|
||||
|
||||
onChange = (e) => {
|
||||
/*
|
||||
Because we named the inputs to match their
|
||||
corresponding values in state, it's
|
||||
super easy to update the state
|
||||
*/
|
||||
this.setState({ [e.target.name]: e.target.value });
|
||||
}
|
||||
|
||||
onSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
// get our form data out of state
|
||||
const { fname, lname, email } = this.state;
|
||||
|
||||
axios.post('/', { fname, lname, email })
|
||||
.then((result) => {
|
||||
//access the results here....
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const { fname, lname, email } = this.state;
|
||||
return (
|
||||
<form onSubmit={this.onSubmit}>
|
||||
<input
|
||||
type="text"
|
||||
name="fname"
|
||||
value={fname}
|
||||
onChange={this.onChange}
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
name="lname"
|
||||
value={lname}
|
||||
onChange={this.onChange}
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
name="email"
|
||||
value={email}
|
||||
onChange={this.onChange}
|
||||
/>
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
}
|
@ -6,15 +6,22 @@ const sql = require('./mysql')
|
||||
function storeAccountToDB(accountDetails) {
|
||||
const encryptedPassword = cryptr.encrypt(accountDetails.password);
|
||||
const result = sql.query(`INSERT userAccounts (username, password, stream, userID) VALUES ("${accountDetails.username}", "${encryptedPassword}", "${accountDetails.stream}", ${accountDetails.userId})`);
|
||||
// console.log(result)
|
||||
return result
|
||||
}
|
||||
|
||||
function retrievePasswordFromDB(user, userAccUser) {
|
||||
let userId = sql.query(`SELECT u.idusers FROM users u WHERE u.userName = '${user}'`);
|
||||
let userId
|
||||
try {
|
||||
userId = sql.query(`SELECT u.idusers FROM users u WHERE u.userName = '${user}'`);
|
||||
userId = userId[0].idusers
|
||||
} catch (error) {
|
||||
console.log('User not found')
|
||||
return (error)
|
||||
}
|
||||
|
||||
let accountPassword = sql.query(`SELECT DISTINCT
|
||||
let accountPassword
|
||||
|
||||
accountPassword = sql.query(`SELECT DISTINCT
|
||||
userAccounts.username,
|
||||
userAccounts.password,
|
||||
userAccounts.userID
|
||||
@ -23,14 +30,15 @@ function retrievePasswordFromDB(user, userAccUser) {
|
||||
streams
|
||||
WHERE userAccounts.userID = ${userId} AND userAccounts.username = '${userAccUser}'`)
|
||||
|
||||
if (accountPassword == 0) {
|
||||
throw new Error('Account ' + userAccUser + ' not found for user ' + user)
|
||||
} else {
|
||||
const decryptedString = cryptr.decrypt(accountPassword[0].password);
|
||||
console.log(decryptedString)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// storePasswordToDB('kcshkzex')
|
||||
|
||||
// retrievePasswordFromDB('Karl', 'Karl0820')
|
||||
retrievePasswordFromDB('Karl', 'Karl2903')
|
||||
|
||||
module.exports = {
|
||||
storeAccountToDB,
|
||||
|
@ -1 +1 @@
|
||||
[{"StreamName":"Insanity","StreamURL":"https://trippy.pro:443"},{"StreamName":"PremPlus","StreamURL":"https://itty.in:443"},{"StreamName":"GunSlinger","StreamURL":"http://gunslingertv.org:8080"},{"StreamName":"VIP","StreamURL":"http://oven-cleaner.com:8080/"},{"StreamName":"Technoid","StreamURL":"http://capoisagod2021.org:8080"},{"StreamName":"Old Premium","StreamURL":"https://caporeds.online:443","username":"Dazg3012","expiaryDate":"12/30/2021"},{"StreamName":"??","StreamURL":"http://screamstreams.info:8080"},{"StreamName":"Gold","StreamURL":"http://catenamode.cf:8090"},{"StreamName":"??","StreamURL":"http://sulu.xyz:2086"},{"StreamName":"??","StreamURL":"http://bigbox.me.uk:2086"},{"StreamName":"??","StreamURL":"http://beautifilm.xyz:8080"},{"StreamName":"??","StreamURL":"https://hulks.xyz:443"},{"StreamName":"??","StreamURL":"http://mytv.digital:8080/"},{"StreamName":"??","StreamURL":"http://theonlinemedia.network:2052"},{"StreamName":"Gold","StreamURL":"http://server1.jforbes.club:8090"},{"StreamName":"??","StreamURL":"http://ths.viewdns.net:8080"},{"StreamName":"??","StreamURL":"http://vpsuk.store:8080"},{"StreamName":"??","StreamURL":"http://ac.mustardsubs.tk:8880"},{"StreamName":"??","StreamURL":"http://faithhosting.xyz:25461"},{"StreamName":"??","StreamURL":"http://ip365.cx:80"},{"StreamName":"??","StreamURL":"http://g132.caporeds.online:8080/"},{"StreamName":"??","StreamURL":"http://theonlinemedia.network:2052"},{"StreamName":"??","StreamURL":"http://beautifilm.xyz:8080"},{"StreamName":"??","StreamURL":"http://pimptv.dnsabr.com:8080"},{"StreamName":"??","StreamURL":"http://tavaratv.xyz:2095"},{"StreamName":"??","StreamURL":"http://cms-tan.media:8880"},{"StreamName":"??","StreamURL":"http://streamknighttv.xyz:8080"},{"StreamName":"??","StreamURL":"http://covidsucks.xyz:8080"},{"StreamName":"??","StreamURL":"http://fckbrexit.link:8080"},{"StreamName":"Gambler","StreamURL":"http://tv.realot.xyz:35001"},{"StreamName":"??","StreamURL":"http://www.tvxclnt.com:8080"},{"StreamName":"??","StreamURL":"http://iptv.satplex.co.uk:8080"},{"StreamName":"??","StreamURL":"http://37723998.to:2052"}]
|
||||
[{"StreamName":"Insanity","StreamURL":"https://trippy.pro:443"},{"StreamName":"PremPlus","StreamURL":"https://itty.in:443"},{"StreamName":"GunSlinger","StreamURL":"http://gunslingertv.org:8080"},{"StreamName":"VIP","StreamURL":"http://oven-cleaner.com:8080/"},{"StreamName":"Technoid","StreamURL":"http://capoisagod2021.org:8080"},{"StreamName":"Old Premium","StreamURL":"https://caporeds.online:443","username":"Dazg3012","expiaryDate":"12/30/2021"},{"StreamName":"??","StreamURL":"http://screamstreams.info:8080"},{"StreamName":"Gold","StreamURL":"http://catenamode.cf:8090"},{"StreamName":"??","StreamURL":"http://sulu.xyz:2086"},{"StreamName":"??","StreamURL":"http://bigbox.me.uk:2086"},{"StreamName":"??","StreamURL":"http://beautifilm.xyz:8080"},{"StreamName":"??","StreamURL":"https://hulks.xyz:443"},{"StreamName":"??","StreamURL":"http://mytv.digital:8080/"},{"StreamName":"??","StreamURL":"http://theonlinemedia.network:2052"},{"StreamName":"Gold","StreamURL":"http://server1.jforbes.club:8090"},{"StreamName":"??","StreamURL":"http://ths.viewdns.net:8080"},{"StreamName":"??","StreamURL":"http://vpsuk.store:8080"},{"StreamName":"??","StreamURL":"http://ac.mustardsubs.tk:8880"},{"StreamName":"??","StreamURL":"http://faithhosting.xyz:25461"},{"StreamName":"??","StreamURL":"http://ip365.cx:80"},{"StreamName":"??","StreamURL":"https://trippy.pro:443"},{"StreamName":"??","StreamURL":"http://g132.caporeds.online:8080/"},{"StreamName":"??","StreamURL":"http://theonlinemedia.network:2052"},{"StreamName":"??","StreamURL":"http://beautifilm.xyz:8080"},{"StreamName":"??","StreamURL":"http://pimptv.dnsabr.com:8080"},{"StreamName":"??","StreamURL":"http://tavaratv.xyz:2095"},{"StreamName":"??","StreamURL":"http://cms-tan.media:8880"},{"StreamName":"??","StreamURL":"http://streamknighttv.xyz:8080"},{"StreamName":"??","StreamURL":"http://covidsucks.xyz:8080"},{"StreamName":"Gambler","StreamURL":"http://fckbrexit.link:8080"},{"StreamName":"??","StreamURL":"http://tv.realot.xyz:35001"},{"StreamName":"??","StreamURL":"http://www.tvxclnt.com:8080"},{"StreamName":"??","StreamURL":"http://iptv.satplex.co.uk:8080"}]
|
13
package-lock.json
generated
13
package-lock.json
generated
@ -125,6 +125,14 @@
|
||||
"resolved": "https://registry.npmjs.org/asap/-/asap-1.0.0.tgz",
|
||||
"integrity": "sha1-sqRdpf36ILBJb8N2jMJ8EvqRan0="
|
||||
},
|
||||
"axios": {
|
||||
"version": "0.21.1",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
|
||||
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
|
||||
"requires": {
|
||||
"follow-redirects": "^1.10.0"
|
||||
}
|
||||
},
|
||||
"babel-runtime": {
|
||||
"version": "6.26.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
|
||||
@ -546,6 +554,11 @@
|
||||
"unpipe": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.13.2",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.2.tgz",
|
||||
"integrity": "sha512-6mPTgLxYm3r6Bkkg0vNM0HTjfGrOEtsfbhagQvbxDEsEkpNhw582upBaoRZylzen6krEmxXJgt9Ju6HiI4O7BA=="
|
||||
},
|
||||
"forwarded": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
|
||||
|
@ -6,6 +6,7 @@
|
||||
"start": "node ./bin/www"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.21.1",
|
||||
"bcrypt": "^5.0.0",
|
||||
"cookie-parser": "~1.4.4",
|
||||
"cryptr": "^6.0.2",
|
||||
|
Loading…
x
Reference in New Issue
Block a user