Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2574b2bf86 | |||
| 0d0cc8f53d | |||
| 1c821addfb |
+1
-5
@@ -3,8 +3,4 @@ node_modules/
|
|||||||
cred.json
|
cred.json
|
||||||
server/uploads/*
|
server/uploads/*
|
||||||
|
|
||||||
package-lock.json
|
#.devcontainer
|
||||||
|
|
||||||
#.devcontainer
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,148 +0,0 @@
|
|||||||
select idStatus from servicio where
|
|
||||||
correo = "318711937@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "317226607@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "abel.albor21@gmail.com" OR
|
|
||||||
correo = "319322073@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "paotiso01@gmail.com" OR
|
|
||||||
correo = "baezar946@gmail.com" OR
|
|
||||||
correo = "eli.bazan97@gmail.com" OR
|
|
||||||
correo = "317246177@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "421122549@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "vicch13@gmail.com" OR
|
|
||||||
correo = "318060390@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "318229797@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "reyeactable2010@gmail.com" OR
|
|
||||||
correo = "adolfo113mart@gmail.com" OR
|
|
||||||
correo = "mc9916986@gmail.com" OR
|
|
||||||
correo = "marianhernan209@gmail.com" OR
|
|
||||||
correo = "lissetterodriguez.752@gmail.com" ;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
| idUsuario | correo | idStatus |
|
|
||||||
+-----------+----------------------------------+----------+
|
|
||||||
| 14814 | mc9916986@gmail.com | 6 |
|
|
||||||
| 14490 | eli.bazan97@gmail.com | 10 |
|
|
||||||
| 19058 | 317226607@pcpuma.acatlan.unam.mx | 6 |
|
|
||||||
| 19081 | 421122549@pcpuma.acatlan.unam.mx | 6 |
|
|
||||||
| 19082 | 317246177@pcpuma.acatlan.unam.mx | 6 |
|
|
||||||
| 19128 | marianhernan209@gmail.com | 6 |
|
|
||||||
| 19015 | 318060390@pcpuma.acatlan.unam.mx | 6 |
|
|
||||||
| 18957 | 318229797@pcpuma.acatlan.unam.mx | 6 |
|
|
||||||
| 19026 | adolfo113mart@gmail.com | 6 |
|
|
||||||
| 19024 | reyeactable2010@gmail.com | 6 |
|
|
||||||
| 19302 | 318711937@pcpuma.acatlan.unam.mx | 6 |
|
|
||||||
| 14490 | eli.bazan97@gmail.com | 6 |
|
|
||||||
| 19514 | abel.albor21@gmail.com | 6 |
|
|
||||||
| 18694 | baezar946@gmail.com | 6 |
|
|
||||||
| 19569 | 319322073@pcpuma.acatlan.unam.mx | 6 |
|
|
||||||
| 19465 | paotiso01@gmail.com | 6 |
|
|
||||||
+-----------+----------------------------------+----------+
|
|
||||||
correo = "eli.bazan97@gmail.com" OR
|
|
||||||
correo = "vicch13@gmail.com" OR
|
|
||||||
correo = "lissetterodriguez.752@gmail.com" ;
|
|
||||||
|
|
||||||
|
|
||||||
-- 14 rows
|
|
||||||
select idStatus from servicio where
|
|
||||||
correo = "318711937@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "317226607@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "abel.albor21@gmail.com" OR
|
|
||||||
correo = "319322073@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "paotiso01@gmail.com" OR
|
|
||||||
correo = "baezar946@gmail.com" OR
|
|
||||||
correo = "317246177@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "421122549@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "318060390@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "318229797@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "reyeactable2010@gmail.com" OR
|
|
||||||
correo = "adolfo113mart@gmail.com" OR
|
|
||||||
correo = "mc9916986@gmail.com" OR
|
|
||||||
correo = "marianhernan209@gmail.com" ;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
update servicio set idStatus = 5 where
|
|
||||||
correo = "318711937@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "317226607@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "abel.albor21@gmail.com" OR
|
|
||||||
correo = "319322073@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "paotiso01@gmail.com" OR
|
|
||||||
correo = "baezar946@gmail.com" OR
|
|
||||||
correo = "317246177@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "421122549@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "318060390@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "318229797@pcpuma.acatlan.unam.mx" OR
|
|
||||||
correo = "reyeactable2010@gmail.com" OR
|
|
||||||
correo = "adolfo113mart@gmail.com" OR
|
|
||||||
correo = "mc9916986@gmail.com" OR
|
|
||||||
correo = "marianhernan209@gmail.com" ;
|
|
||||||
|
|
||||||
|
|
||||||
-- servicio de eli
|
|
||||||
+------------+----------+
|
|
||||||
| idServicio | idStatus |
|
|
||||||
+------------+----------+
|
|
||||||
| 12605 | 10 |
|
|
||||||
| 16825 | 6 |
|
|
||||||
+------------+----------+
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- update servicio set idStatus = 5 where idServicio = 16825;
|
|
||||||
update servicio set idStatus = 5 where idServicio = 16825;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
select idStatus from caso_especial where
|
|
||||||
correo = "lissetterodriguez.752@gmail.com" OR correo = "vicch13@gmail.com";
|
|
||||||
|
|
||||||
MariaDB [midatabase]> select idStatus from caso_especial where
|
|
||||||
-> correo = "lissetterodriguez.752@gmail.com" OR correo = "vicch13@gmail.com";
|
|
||||||
+----------+
|
|
||||||
| idStatus |
|
|
||||||
+----------+
|
|
||||||
| 14 |
|
|
||||||
| 14 |
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
update caso_especial set idStatus = 12 where
|
|
||||||
correo = "lissetterodriguez.752@gmail.com" OR correo = "vicch13@gmail.com";
|
|
||||||
|
|
||||||
update caso_especial set idStatus = 12 where
|
|
||||||
correo = "lissetterodriguez.752@gmail.com" OR correo = "vicch13@gmail.com";
|
|
||||||
|
|
||||||
|
|
||||||
+----------+
|
|
||||||
| idStatus |
|
|
||||||
+----------+
|
|
||||||
| 12 |
|
|
||||||
| 12 |
|
|
||||||
+----------+
|
|
||||||
2 rows in set (0.001 sec)
|
|
||||||
|
|
||||||
|
|
||||||
--- 19058 317226607@pcpuma.acatlan.unam.mx 5
|
|
||||||
--- 19081 421122549@pcpuma.acatlan.unam.mx 5
|
|
||||||
--- 19082 317246177@pcpuma.acatlan.unam.mx 5
|
|
||||||
--- 19128 marianhernan209@gmail.com 5
|
|
||||||
--- 19015 318060390@pcpuma.acatlan.unam.mx 5
|
|
||||||
--- 18957 318229797@pcpuma.acatlan.unam.mx 5
|
|
||||||
--- 19026 adolfo113mart@gmail.com 5
|
|
||||||
--- 19024 reyeactable2010@gmail.com 5
|
|
||||||
--- 19302 318711937@pcpuma.acatlan.unam.mx 5
|
|
||||||
--- 14490 eli.bazan97@gmail.com 5
|
|
||||||
--- 19514 abel.albor21@gmail.com 5
|
|
||||||
--- 21353 14 vicch13@gmail.com
|
|
||||||
--- 21361 14 lissetterodriguez.752@gmail.com
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
process.env.CLIENT_ID_GMAIL
|
|
||||||
process.env.CLIENT_SECRET_GMAIL
|
|
||||||
process.env.REDIRECT_URI_GMAIL
|
|
||||||
process.env.REFRESH_TOKEN_GMAIL
|
|
||||||
process.env.USER_GMAIL_GMAIL
|
|
||||||
Generated
-1
@@ -1223,7 +1223,6 @@
|
|||||||
"version": "65.0.0",
|
"version": "65.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/googleapis/-/googleapis-65.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/googleapis/-/googleapis-65.0.0.tgz",
|
||||||
"integrity": "sha512-dcfZVkML8H6mPAsph0hgfyRQYKJpw2XjKchAXx5YEfDYWU7021Mpzaf+ejNSipa3QmcfOLOcWg6sUr0I7M4jjQ==",
|
"integrity": "sha512-dcfZVkML8H6mPAsph0hgfyRQYKJpw2XjKchAXx5YEfDYWU7021Mpzaf+ejNSipa3QmcfOLOcWg6sUr0I7M4jjQ==",
|
||||||
"license": "Apache-2.0",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"google-auth-library": "^6.0.0",
|
"google-auth-library": "^6.0.0",
|
||||||
"googleapis-common": "^4.4.1"
|
"googleapis-common": "^4.4.1"
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
const helperPath = '../../helper';
|
||||||
|
const encriptar = require(`${helperPath}/encriptar`);
|
||||||
|
const dbPath = '../../db/tablas';
|
||||||
|
const Usuario = require(`${dbPath}/Usuario`);
|
||||||
|
|
||||||
|
const newAdmin = async (body) => {
|
||||||
|
const password = encriptar.generarPassword();
|
||||||
|
|
||||||
|
|
||||||
|
await Usuario.create({
|
||||||
|
usuario: body.usuario,
|
||||||
|
password: encriptar.encriptar(password),
|
||||||
|
nombre: body.nombre,
|
||||||
|
activo: true,
|
||||||
|
idTipoUsuario: body.idTipoUsuario,
|
||||||
|
})
|
||||||
|
return password;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = newAdmin;
|
||||||
+1
-59
@@ -1,4 +1,4 @@
|
|||||||
/* require('../config/config'); // mantiene tu carga de variables
|
require('../config/config'); // mantiene tu carga de variables
|
||||||
const nodemailer = require('nodemailer');
|
const nodemailer = require('nodemailer');
|
||||||
|
|
||||||
const transporter = nodemailer.createTransport({
|
const transporter = nodemailer.createTransport({
|
||||||
@@ -23,62 +23,4 @@ const gmail = (subject, to, text) =>
|
|||||||
});
|
});
|
||||||
|
|
||||||
module.exports = gmail;
|
module.exports = gmail;
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require('../config/config');
|
|
||||||
const nodemailer = require('nodemailer');
|
|
||||||
const { google } = require('googleapis');
|
|
||||||
|
|
||||||
const oAuth2Client = new google.auth.OAuth2(
|
|
||||||
process.env.CLIENT_ID_GMAIL,
|
|
||||||
process.env.CLIENT_SECRET_GMAIL,
|
|
||||||
process.env.REDIRECT_URI_GMAIL // puedes usar "https://developers.google.com/oauthplayground"
|
|
||||||
);
|
|
||||||
|
|
||||||
oAuth2Client.setCredentials({
|
|
||||||
refresh_token: process.env.REFRESH_TOKEN_GMAIL,
|
|
||||||
});
|
|
||||||
|
|
||||||
async function sendMail(subject, to, text) {
|
|
||||||
try {
|
|
||||||
const accessToken = await oAuth2Client.getAccessToken();
|
|
||||||
|
|
||||||
const transporter = nodemailer.createTransport({
|
|
||||||
service: 'gmail',
|
|
||||||
auth: {
|
|
||||||
type: 'OAuth2',
|
|
||||||
user: process.env.USER_GMAIL_GMAIL,
|
|
||||||
clientId: process.env.CLIENT_ID_GMAIL,
|
|
||||||
clientSecret: process.env.CLIENT_SECRET_GMAIL,
|
|
||||||
refreshToken: process.env.REFRESH_TOKEN_GMAIL,
|
|
||||||
accessToken: accessToken.token,
|
|
||||||
},
|
|
||||||
pool: true,
|
|
||||||
maxConnections: 1,
|
|
||||||
maxMessages: 100,
|
|
||||||
rateDelta: 2000,
|
|
||||||
rateLimit: 1,
|
|
||||||
});
|
|
||||||
|
|
||||||
const result = await transporter.sendMail({
|
|
||||||
from: process.env.USER_GMAIL_GMAIL,
|
|
||||||
to,
|
|
||||||
subject,
|
|
||||||
text,
|
|
||||||
});
|
|
||||||
|
|
||||||
return result;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error al enviar correo:', error);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = sendMail;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ const route = '/usuario';
|
|||||||
const controllerPath = '../controller/Usuario';
|
const controllerPath = '../controller/Usuario';
|
||||||
const escolares = require(`${controllerPath}/escolares`);
|
const escolares = require(`${controllerPath}/escolares`);
|
||||||
const login = require(`${controllerPath}/login`);
|
const login = require(`${controllerPath}/login`);
|
||||||
|
const newAdmin = require(`${controllerPath}/newUser`);
|
||||||
const newPasswordAlumno = require(`${controllerPath}/newPasswordAlumno`);
|
const newPasswordAlumno = require(`${controllerPath}/newPasswordAlumno`);
|
||||||
const newPasswordResponsable = require(`${controllerPath}/newPasswordResponsable`);
|
const newPasswordResponsable = require(`${controllerPath}/newPasswordResponsable`);
|
||||||
const responsable = require(`${controllerPath}/responsable`);
|
const responsable = require(`${controllerPath}/responsable`);
|
||||||
@@ -22,6 +23,17 @@ app.post(`${route}/login`, (req, res) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// POST
|
||||||
|
app.post(`${route}/newAdmin`, (req, res) => {
|
||||||
|
return newAdmin(req.body)
|
||||||
|
.then((data) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
res.status(400).json({ message: err.message });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// GET
|
// GET
|
||||||
app.get(`${route}/escolares`, verificaToken, (req, res) => {
|
app.get(`${route}/escolares`, verificaToken, (req, res) => {
|
||||||
return escolares(req.query)
|
return escolares(req.query)
|
||||||
|
|||||||
Reference in New Issue
Block a user