Spaces:
Sleeping
Sleeping
Update templates/sign-up.html
Browse files- templates/sign-up.html +125 -89
templates/sign-up.html
CHANGED
@@ -110,107 +110,143 @@
|
|
110 |
}
|
111 |
</style>
|
112 |
<style>
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
</style>
|
127 |
<body>
|
128 |
<!--$-->
|
129 |
<div class="techwave_fn_sign">
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
{% endwith %}
|
143 |
-
|
144 |
-
<div class="form__title">Sign Up</div>
|
145 |
-
<br>
|
146 |
-
{% with messages = get_flashed_messages() %}
|
147 |
-
{% if messages %}
|
148 |
-
<ul>
|
149 |
{% for message in messages %}
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
{% endfor %}
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
</div>
|
191 |
</div>
|
192 |
-
|
193 |
-
|
|
|
194 |
function validateForm() {
|
195 |
-
|
196 |
-
|
|
|
|
|
|
|
197 |
|
198 |
-
|
199 |
-
|
200 |
-
errorMessage.className = "error-message";
|
201 |
-
errorMessage.innerHTML = "Passwords do not match";
|
202 |
|
203 |
-
|
204 |
-
|
205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
|
213 |
-
<p>Already have an account? <a href="/">Sign In</a></p>
|
214 |
</div>
|
215 |
</div>
|
216 |
</div>
|
|
|
110 |
}
|
111 |
</style>
|
112 |
<style>
|
113 |
+
.error-message {
|
114 |
+
color: red;
|
115 |
+
border: 1px solid red;
|
116 |
+
padding: 10px;
|
117 |
+
list-style: none;
|
118 |
+
}
|
119 |
+
|
120 |
+
.success-message {
|
121 |
+
color: green;
|
122 |
+
border: 1px solid green;
|
123 |
+
padding: 10px;
|
124 |
+
list-style: none;
|
125 |
+
}
|
126 |
</style>
|
127 |
<body>
|
128 |
<!--$-->
|
129 |
<div class="techwave_fn_sign">
|
130 |
+
<div class="sign__content">
|
131 |
+
<img src="desine/img/logo-desktop-full.png">
|
132 |
+
<br>
|
133 |
+
<h1 class="logo">Designed by Frenify</h1>
|
134 |
+
<form class="signup" method="POST" action="/sign-up" onsubmit="return validateForm()" enctype="multipart/form-data">
|
135 |
+
<div class="form__content">
|
136 |
+
<h1 class="logo">Designed by Frenify</h1>
|
137 |
+
<br>
|
138 |
+
|
139 |
+
{% with messages = get_flashed_messages() %}
|
140 |
+
{% if messages %}
|
141 |
+
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
{% for message in messages %}
|
143 |
+
{% if message == "Username is already taken. Please choose a different username." %}
|
144 |
+
<li class="error-message">{{ message }}</li>
|
145 |
+
{% elif message == "Failed to upload image to DataBase." %}
|
146 |
+
<li class="error-message">{{ message }}</li>
|
147 |
+
{% else %}
|
148 |
+
|
149 |
+
{% endif %}
|
150 |
{% endfor %}
|
151 |
+
</ul>
|
152 |
+
{% endif %}
|
153 |
+
{% endwith %}
|
154 |
+
<div class="form__username">
|
155 |
+
<label for="first_name">First Name</label>
|
156 |
+
<input type="text" class="input" id="first_name" name="first_name" placeholder="First Name" required />
|
157 |
+
</div>
|
158 |
+
<div class="form__username">
|
159 |
+
<label for="last_name">Last Name</label>
|
160 |
+
<input type="text" class="input" id="last_name" name="last_name" placeholder="Last Name" required />
|
161 |
+
</div>
|
162 |
+
<div class="form__username">
|
163 |
+
<label for="username">Username</label>
|
164 |
+
<input type="text" class="input" id="username" name="username" placeholder="Username" required />
|
165 |
+
</div>
|
166 |
+
<div class="form__pass">
|
167 |
+
<label for="password">Password</label>
|
168 |
+
<input type="password" id="password" name="password" autoComplete="current-password" spellCheck="false" placeholder="password" required />
|
169 |
+
</div>
|
170 |
+
<div class="form__confirm-pass">
|
171 |
+
<label for="confirm_password">Confirm Password</label>
|
172 |
+
<input type="password" id="confirm_password" name="confirm_password" autoComplete="current-password" spellCheck="false" placeholder="Confirm password" required />
|
173 |
+
</div>
|
174 |
+
<br>
|
175 |
+
<div class="input-div">
|
176 |
+
<input class="input2" type="file" id="profile_image" name="profile_image" required onchange="displayImageName()">
|
177 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" stroke-linejoin="round" stroke-linecap="round" viewBox="0 0 24 24" stroke-width="2" fill="none" stroke="currentColor" class="icon"><polyline points="16 16 12 12 8 16"></polyline><line y2="21" x2="12" y1="12" x1="12"></line><path d="M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3"></path><polyline points="16 16 12 12 8 16"></polyline></svg>
|
178 |
+
</div>
|
179 |
+
<br>
|
180 |
+
<p class="file-message" id="file-message">Please upload an image for your profile</p>
|
181 |
+
<br>
|
182 |
+
<div class="form__submit">
|
183 |
+
<label class="fn__submit">
|
184 |
+
<input type="submit" name="submit" value="Create Account" />
|
185 |
+
</label>
|
186 |
+
</div>
|
187 |
+
<div class="form__alternative ">
|
188 |
+
<div class="fn__lined_text">
|
|
|
189 |
</div>
|
190 |
+
</div>
|
191 |
+
|
192 |
+
<script>
|
193 |
function validateForm() {
|
194 |
+
var password = document.getElementById("password").value;
|
195 |
+
var confirm_password = document.getElementById("confirm_password").value;
|
196 |
+
var username = document.getElementById("username").value;
|
197 |
+
var passwordErrorMessage = document.createElement("p");
|
198 |
+
var usernameErrorMessage = document.createElement("p");
|
199 |
|
200 |
+
passwordErrorMessage.className = "error-message";
|
201 |
+
usernameErrorMessage.className = "error-message";
|
|
|
|
|
202 |
|
203 |
+
// Clear previous error messages
|
204 |
+
var errorMessages = document.querySelectorAll(".error-message");
|
205 |
+
errorMessages.forEach(function(message) {
|
206 |
+
message.remove();
|
207 |
+
});
|
208 |
+
|
209 |
+
// Password validation
|
210 |
+
if (password.length < 8 || !/[A-Z]/.test(password)) {
|
211 |
+
passwordErrorMessage.innerHTML = "Password must be at least 8 characters long and contain at least one capital letter.";
|
212 |
+
var passwordField = document.getElementById("password");
|
213 |
+
passwordField.insertAdjacentElement("afterend", passwordErrorMessage);
|
214 |
+
return false;
|
215 |
+
}
|
216 |
+
|
217 |
+
if (password !== confirm_password) {
|
218 |
+
var confirmPassField = document.getElementById("confirm_password");
|
219 |
+
var confirmErrorMessage = document.createElement("p");
|
220 |
+
confirmErrorMessage.className = "error-message";
|
221 |
+
confirmErrorMessage.innerHTML = "Passwords do not match.";
|
222 |
+
confirmPassField.insertAdjacentElement("afterend", confirmErrorMessage);
|
223 |
+
return false;
|
224 |
+
}
|
225 |
|
226 |
+
// Username validation
|
227 |
+
if (username.length < 6 || /[A-Z]/.test(username) || /[^a-z0-9]/.test(username)) {
|
228 |
+
usernameErrorMessage.innerHTML = "Username must be at least 6 characters long, contain no capital letters, and contain no special symbols.";
|
229 |
+
var usernameField = document.getElementById("username");
|
230 |
+
usernameField.insertAdjacentElement("afterend", usernameErrorMessage);
|
231 |
+
return false;
|
232 |
+
}
|
233 |
+
|
234 |
+
return true;
|
235 |
+
}
|
236 |
+
|
237 |
+
function displayImageName() {
|
238 |
+
var input = document.getElementById('profile_image');
|
239 |
+
var fileMessage = document.getElementById('file-message');
|
240 |
+
|
241 |
+
if (input.files && input.files[0]) {
|
242 |
+
fileMessage.innerText = "Uploaded file: " + input.files[0].name;
|
243 |
+
} else {
|
244 |
+
fileMessage.innerText = "Please upload an image for your profile";
|
245 |
+
}
|
246 |
+
}
|
247 |
+
</script> <div class="sign__desc">
|
248 |
|
249 |
+
<p>Already have an account? <a href="/login">Sign In</a></p>
|
250 |
</div>
|
251 |
</div>
|
252 |
</div>
|