fix: audit 89 bugs - critical fixes
CRITICAL: - JwtMiddleware orden (antes de UseAuthentication) - JWT Secret en appsettings.json (no vacio) - Transbank MySQL connection string (User=root + placeholder) - package-lock generado + Dockerfile usa npm install - Tests E2E: selectores corregidos con name attributes - Tests: rut invalido reemplazado, casos sin auth - Contacto page: apunta a services-externos (no backend) - .env.example: credenciales reales -> placeholders HIGH: - extra_hosts agregado a services-externos en compose - Dockerfile frontend: npm ci -> npm install
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
FROM node:20-alpine AS build
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
RUN npm install
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
|
||||
@@ -1,21 +1,30 @@
|
||||
'use client';
|
||||
|
||||
import { useState, FormEvent } from 'react';
|
||||
import { api } from '@/services/api';
|
||||
|
||||
const SERVICES_URL = process.env.NEXT_PUBLIC_SERVICES_URL || 'http://localhost:5001/api';
|
||||
|
||||
export default function ContactoPage() {
|
||||
const [mail, setMail] = useState('');
|
||||
const [mensaje, setMensaje] = useState('');
|
||||
const [enviando, setEnviando] = useState(false);
|
||||
|
||||
const handleSubmit = async (e: FormEvent) => {
|
||||
e.preventDefault();
|
||||
setEnviando(true);
|
||||
try {
|
||||
await api.post('/email/send', { to: mail, subject: 'Contacto desde SAM', body: mensaje });
|
||||
await fetch(`${SERVICES_URL}/email/send`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ to: mail, subject: 'Contacto desde SAM', body: mensaje }),
|
||||
});
|
||||
alert('Correo enviado');
|
||||
setMail('');
|
||||
setMensaje('');
|
||||
} catch {
|
||||
alert('Error al enviar');
|
||||
} finally {
|
||||
setEnviando(false);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -50,11 +50,11 @@ export default function LoginPage() {
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="mb-3">
|
||||
<label className="form-label">RUT</label>
|
||||
<input className="form-control" value={rut} onChange={handleRutChange} placeholder="12.345.678-5" />
|
||||
<input name="rut" className="form-control" value={rut} onChange={handleRutChange} placeholder="12.345.678-5" />
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label className="form-label">Clave</label>
|
||||
<input type="password" className="form-control" value={clave} onChange={e => setClave(e.target.value)} />
|
||||
<input type="password" name="clave" className="form-control" value={clave} onChange={e => setClave(e.target.value)} />
|
||||
</div>
|
||||
{error && <div className="alert alert-danger py-2">{error}</div>}
|
||||
<button type="submit" className="btn btn-primary w-100">Ingresar</button>
|
||||
|
||||
Reference in New Issue
Block a user