From 7b3499558c8d097d4aab9caa14332939e3bfb4a7 Mon Sep 17 00:00:00 2001 From: JacksonSovilay Date: Sun, 29 Sep 2024 18:42:26 -0500 Subject: [PATCH] Added requirements for email formatting, password length, and functionality to show password checkbox. Created register page javascript file. --- static/register.html | 47 ++++++++++++++++++++++++++------------------ static/register.js | 33 +++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 19 deletions(-) create mode 100644 static/register.js diff --git a/static/register.html b/static/register.html index 75e693f..00f2f65 100644 --- a/static/register.html +++ b/static/register.html @@ -9,27 +9,36 @@ + +
+

Registration

-
-
- - -
We'll never share your email with anyone else.
-
-
- - -
-
- - -
- + +
+ + +
Email must be an @my.utsa.edu email.
+
+ +
+ + +
Password must be over 8 characters.
+
+ +
+ + +
+ + Already have an account? Click here to login. - -

- - +
+

+ + +
+ diff --git a/static/register.js b/static/register.js new file mode 100644 index 0000000..fa4f5b8 --- /dev/null +++ b/static/register.js @@ -0,0 +1,33 @@ +const email = document.getElementById("email"); +const emailHelp = document.getElementById("emailHelp"); +const emailRegex = /^[^\s@]+@my\.utsa\.edu$/; +const password = document.getElementById("password"); +const passwordHelp = document.getElementById("passwordHelp"); +const passwordRegex = /^.{8,}$/; + +function showPass(){ + if(password.type === "password"){ + password.type = "text"; + } + else{ + password.type = "password"; + } +} + +function passCheck(){ + if(passwordRegex.test(password.value)){ + passwordHelp.style.color = "#66cc66"; + } + else{ + passwordHelp.style.color = "#ff6666"; + } +} + +function emailCheck(){ + if(emailRegex.test(email.value)){ + emailHelp.style.color = "#66cc66"; + } + else{ + emailHelp.style.color = "#ff6666"; + } +} \ No newline at end of file