diff --git a/.gitignore b/.gitignore index 049313d..b3a52f7 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ target/ .settings .springBeans .sts4-cache +.hola jose ### NetBeans ### /nbproject/private/ diff --git a/.idea/encodings.xml b/.idea/encodings.xml index 63e9001..aa00ffa 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/src/main/java/com/roshka/proyectofinal/LoginHandler.java b/src/main/java/com/roshka/proyectofinal/LoginHandler.java new file mode 100644 index 0000000..4d7999f --- /dev/null +++ b/src/main/java/com/roshka/proyectofinal/LoginHandler.java @@ -0,0 +1,52 @@ +package com.roshka.proyectofinal; + +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; + +import java.io.*; + +public class LoginHandler extends HttpServlet { + + public void doPost(HttpServletRequest req, HttpServletResponse res) + throws ServletException, IOException { + res.setContentType("text/html"); + PrintWriter out = res.getWriter(); + + // Get the user's name and password + String name = req.getParameter("name"); + String passwd = req.getParameter("passwd"); + + // Check the name and password for validity + if (!allowUser(name, passwd)) { + out.println("<HTML><HEAD><TITLE>Access Denied</TITLE></HEAD>"); + out.println("<BODY>Your login and password are invalid.<BR>"); + out.println("You may want to <A HREF=\"/login.html\">try again</A>"); + out.println("</BODY></HTML>"); + } + else { + // Valid login. Make a note in the session object. + HttpSession session = req.getSession(true); + session.putValue("logon.isDone", name); // just a marker object + + // Try redirecting the client to the page he first tried to access + try { + String target = (String) session.getValue("login.target"); + if (target != null) + res.sendRedirect(target); + return; + } + catch (Exception ignored) { } + + // Couldn't redirect to the target. Redirect to the site's home page. + res.sendRedirect(req.getScheme() + "://" + + req.getServerName() + ":" + req.getServerPort()); + } + } + + protected boolean allowUser(String user, String passwd) { + return true; // trust everyone + } +} \ No newline at end of file diff --git a/src/main/java/com/roshka/proyectofinal/ProtectedResource.java b/src/main/java/com/roshka/proyectofinal/ProtectedResource.java new file mode 100644 index 0000000..9c45921 --- /dev/null +++ b/src/main/java/com/roshka/proyectofinal/ProtectedResource.java @@ -0,0 +1,30 @@ +package com.roshka.proyectofinal; + +import java.io.*; +import java.util.*; +import jakarta.servlet.*; +import jakarta.servlet.http.*; + +public class ProtectedResource extends HttpServlet { + + public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { + res.setContentType("text/plain"); + PrintWriter out = res.getWriter(); + + // Get the session + HttpSession session = req.getSession(true); + + // Does the session indicate this user already logged in? + Object done = session.getValue("logon.isDone"); + // marker object + if (done == null) { + // No logon.isDone means he hasn't logged in. // Save the request URL as the true target and redirect to the login page + session.putValue("login.target", + HttpUtils.getRequestURL(req).toString()); res.sendRedirect(req.getScheme() + "://" + req.getServerName() + ":" + + req.getServerPort() + "/login.html"); + return; + } + // If we get here, the user has logged in and can see the goods + out.println("Unpublished O'Reilly book manuscripts await you!"); + } + } \ No newline at end of file diff --git a/src/main/java/com/roshka/proyectofinal/entity/LoginBean.java b/src/main/java/com/roshka/proyectofinal/entity/LoginBean.java new file mode 100644 index 0000000..9b2ad7e --- /dev/null +++ b/src/main/java/com/roshka/proyectofinal/entity/LoginBean.java @@ -0,0 +1,22 @@ +package com.roshka.proyectofinal.entity; + +public class LoginBean { + private String username; + private String password; + + public String getUsername() { + return username; + } + + public String getPassword() { + return password; + } + + public void setUsername(String username) { + this.username = username; + } + + public void setPassword(String password) { + this.password = password; + } +} diff --git a/src/main/java/com/roshka/proyectofinal/login/LoginDao.java b/src/main/java/com/roshka/proyectofinal/login/LoginDao.java new file mode 100644 index 0000000..8ab20f8 --- /dev/null +++ b/src/main/java/com/roshka/proyectofinal/login/LoginDao.java @@ -0,0 +1,33 @@ +package com.roshka.proyectofinal.login; + +import com.roshka.proyectofinal.DataBase; +import com.roshka.proyectofinal.entity.Lenguaje; +import com.roshka.proyectofinal.entity.LoginBean; + +import java.sql.Connection; +import java.sql.PreparedStatement; + +public class LoginDao { + + public boolean validate (LoginBean loginBean) { + int status = 0; + try { + Connection con = DataBase.getConnection(); + + PreparedStatement ps=con.prepareStatement( + "select * from usuarios where username=? and password = ?"); + ps.setString(1,loginBean.getUsername()); + ps.setString(2, loginBean.getPassword()); + status=ps.executeUpdate(); + + con.close(); + } catch (Exception ex) { + ex.printStackTrace(); + } + + if (status > 0) return true ; + else return false ; + + } + +} diff --git a/src/main/java/com/roshka/proyectofinal/login/LoginServlet.java b/src/main/java/com/roshka/proyectofinal/login/LoginServlet.java new file mode 100644 index 0000000..c251007 --- /dev/null +++ b/src/main/java/com/roshka/proyectofinal/login/LoginServlet.java @@ -0,0 +1,61 @@ +package com.roshka.proyectofinal.login; + + +import java.io.IOException; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +import com.roshka.proyectofinal.entity.LoginBean; + +/** + * Servlet implementation class LoginServlet + */ +@WebServlet("/login") +public class LoginServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public LoginServlet() { + super(); + // TODO Auto-generated constructor stub + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + // TODO Auto-generated method stub + response.getWriter().append("Served at: ").append(request.getContextPath()); + } + + /** + * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) + */ + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + LoginDao loginDao = new LoginDao(); + + String username = request.getParameter("username"); + String password = request.getParameter("password"); + LoginBean loginBean = new LoginBean(); + loginBean.setUsername(username); + loginBean.setPassword(password); + + + if (loginDao.validate(loginBean)) + { + response.sendRedirect("loginSuccess.jsp"); + + } + else { + //HttpSession session = request.getSession(); + response.sendRedirect("login.jsp"); + + } + } + +} \ No newline at end of file diff --git a/src/main/webapp/estilos/home.css b/src/main/webapp/estilos/home.css new file mode 100644 index 0000000..95ec9ca --- /dev/null +++ b/src/main/webapp/estilos/home.css @@ -0,0 +1,146 @@ +img.logoi{ + width: 200px; + +} + +img{ + width: 400px; + padding: 10px; + display: block; + padding:10px ; +} +.header { + margin-bottom: 0; + width: 700px; +} +a{ + float: right 100px; + color: #fff; + font-size: larger; + text-decoration: none; + padding: 10px; + +} + +body { + background: linear-gradient(100deg, rgba(20, 99, 155, 0.25), rgba(30, 148, 227, 0.25)); + background-image: url(webapp/imagenes/descarga.svg); + + background-size: contain; + background-attachment: fixed; + background-blend-mode: multiply; + font-family: Georgia, 'Times New Roman', Times, serif; + color: white; + position: relative; + width: 100px; + height: 100px; +} +/* ul{ + list-style: none; +} +.menu >ul{ + float: right; +} + +.menu li a { + + color:#fff; + text-decoration:none; + padding:10px 12px; + display:block; +} + +.menu li ul li { + marging-left + position:relative; +} */ +.menu { + width: 400%; + float: left; + + } + + .menu ul li { + float: right; + list-style-type: none; + text-align: right; + } + div.menu{ + float: right; + + + } + html, body { + margin:0; + padding:0; + height:100%; + } + + .menu ul li a { + padding-left: 5px; + + font-size: clamp(145px); + text-transform: uppercase; + display: block; + position: relative; + overflow: hidden; + padding-bottom: 50px; + white-space: nowrap; + } + .grafico,svg { + max-width: 50px; + display: block; + height: auto; +} +.seccion.hero { + margin-top: 10px; + padding-bottom: 10px; + width: 900px; +} +.hero { + perspective: 100px; +} +.hero { + display: grid; + grid-template-columns: auto repeat(5, 0.5fr) auto; +} +.hero { + display: flex; + flex-direction: column; + align-items: center; + padding-left: 200px; + /* padding-right: 200px; + */ +} +/* */ + .postulacion{ +border-radius: 30px; +} +.cta-main{ + width: 200px; + font-family: monospace; +background-color: yellow; +border: none; +} +/* Contenido pie de pagina */ +/* usamos media quiere para el responsive */ +/* @media (min-width: 768px) +.footer { + display: grid; + grid-template-rows: auto auto; + align-items: flex-start; + gap: 0; + padding: 80px 20px +} */ +.footer{ + margin-top: 10px; + padding-bottom: 10px; + height:100px; + width: 100px; + display: grid; +} + +.menu-footer a{ + text-decoration: none; + float: right; +} \ No newline at end of file diff --git a/src/main/webapp/imagenes/descarga.svg b/src/main/webapp/imagenes/descarga.svg new file mode 100644 index 0000000..ee8c3f6 --- /dev/null +++ b/src/main/webapp/imagenes/descarga.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/webapp/imagenes/icon-email.svg b/src/main/webapp/imagenes/icon-email.svg new file mode 100644 index 0000000..74ce158 --- /dev/null +++ b/src/main/webapp/imagenes/icon-email.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/main/webapp/imagenes/icon-location.ico b/src/main/webapp/imagenes/icon-location.ico new file mode 100644 index 0000000..b810fe9 Binary files /dev/null and b/src/main/webapp/imagenes/icon-location.ico differ diff --git a/src/main/webapp/imagenes/icon-location.svg b/src/main/webapp/imagenes/icon-location.svg new file mode 100644 index 0000000..32ec604 --- /dev/null +++ b/src/main/webapp/imagenes/icon-location.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/main/webapp/imagenes/icon-phone.svg b/src/main/webapp/imagenes/icon-phone.svg new file mode 100644 index 0000000..e2cf3c6 --- /dev/null +++ b/src/main/webapp/imagenes/icon-phone.svg @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/imagenes/ilustracion-herov3.svg b/src/main/webapp/imagenes/ilustracion-herov3.svg new file mode 100644 index 0000000..e5d7772 --- /dev/null +++ b/src/main/webapp/imagenes/ilustracion-herov3.svg @@ -0,0 +1,288 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/imagenes/logo-roshka.svg b/src/main/webapp/imagenes/logo-roshka.svg new file mode 100644 index 0000000..db74015 --- /dev/null +++ b/src/main/webapp/imagenes/logo-roshka.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/main/webapp/imagenes/logo_footer.svg b/src/main/webapp/imagenes/logo_footer.svg new file mode 100644 index 0000000..4fa8d55 --- /dev/null +++ b/src/main/webapp/imagenes/logo_footer.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/main/webapp/imagenes/roshkaicon.ico b/src/main/webapp/imagenes/roshkaicon.ico new file mode 100644 index 0000000..234d919 Binary files /dev/null and b/src/main/webapp/imagenes/roshkaicon.ico differ diff --git a/src/main/webapp/imagenes/social-fb.svg b/src/main/webapp/imagenes/social-fb.svg new file mode 100644 index 0000000..10c1fdf --- /dev/null +++ b/src/main/webapp/imagenes/social-fb.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/main/webapp/imagenes/social-ig.svg b/src/main/webapp/imagenes/social-ig.svg new file mode 100644 index 0000000..99bee1c --- /dev/null +++ b/src/main/webapp/imagenes/social-ig.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/main/webapp/imagenes/social-linkedin.svg b/src/main/webapp/imagenes/social-linkedin.svg new file mode 100644 index 0000000..935f63b --- /dev/null +++ b/src/main/webapp/imagenes/social-linkedin.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/main/webapp/imagenes/social-twitter.svg b/src/main/webapp/imagenes/social-twitter.svg new file mode 100644 index 0000000..d7776de --- /dev/null +++ b/src/main/webapp/imagenes/social-twitter.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html new file mode 100644 index 0000000..86aff9e --- /dev/null +++ b/src/main/webapp/index.html @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + Roshka WebSite + +
+ + + +
+ + + +
+
+ + + + + + +






+
+
+

Es tu turno Postulate para el bootcamp

+

Aprende

+
+
+
+

Es un campo de entrenamiento intensivo y gratuito para principiantes que ya programan y quieren ser parte de la empresa

+
+
+ + +
+
+ +
+ +
+ + + +
+ + +
+ + + + + + + diff --git a/src/main/webapp/login.jsp b/src/main/webapp/login.jsp new file mode 100644 index 0000000..1f1dadf --- /dev/null +++ b/src/main/webapp/login.jsp @@ -0,0 +1,21 @@ +<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> + + + + BootcampsLogin + + +
+

User Login Form

+
+ + + + + +
User Name:
Password:
+
+
+ + + \ No newline at end of file diff --git a/src/main/webapp/loginSuccess.jsp b/src/main/webapp/loginSuccess.jsp new file mode 100644 index 0000000..2d4e892 --- /dev/null +++ b/src/main/webapp/loginSuccess.jsp @@ -0,0 +1,16 @@ +<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> + + + + +LoginExitoso + + + +
+

LOGGIN EXITOSO

+ + +
+ + \ No newline at end of file