From: Alviro Iskandar Setiawan <[email protected]>
To: Fernanda Ma'rouf <[email protected]>,
Akiekano <[email protected]>
Cc: Alviro Iskandar Setiawan <[email protected]>,
Alviro Iskandar Setiawan <[email protected]>,
GNU/Weeb Mailing List <[email protected]>
Subject: [PATCH buubuu v1 1/5] view: Create register.html
Date: Fri, 27 May 2022 20:39:16 +0000 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAOG64qNDyrKyV_TqTdP6pdVAyTn1=hRppnOoJ=e9T73C9Nsjmg@mail.gmail.com>
Create register.html view file. We will render this file from Register()
function in the auth-controller.
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
---
view/register.html | 84 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 84 insertions(+)
create mode 100644 view/register.html
diff --git a/view/register.html b/view/register.html
new file mode 100644
index 0000000..1f9e6c7
--- /dev/null
+++ b/view/register.html
@@ -0,0 +1,84 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Register</title>
+</head>
+<body>
+<div class="register_form_box">
+ <h1>Registration Form</h1>
+ <form id="register_form" method="POST" action="javascript:void(0);">
+ <table id="register_table">
+ <tr>
+ <td align="left">Name</td>
+ <td>:</td>
+ <td><input type="text" id="name" name="name" required="1"/></td>
+ </tr>
+ <tr>
+ <td align="left">Email</td>
+ <td>:</td>
+ <td><input type="text" id="email" name="email" required="1"/></td></tr>
+ <tr>
+ <td align="left">Password</td>
+ <td>:</td>
+ <td><input type="password" id="password" name="password" required="1"/></td></tr>
+ <tr>
+ <td align="left">Retype Password</td>
+ <td>:</td>
+ <td><input type="password" id="cpassword" name="cpassword" required="1"/></td>
+ </tr>
+ <tr>
+ <td colspan="3" align="center">
+ <div style="margin-top: 20px; margin-bottom: 20px;">
+ <input type="submit" name="submit" value="Register"/>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </form>
+</div>
+<style type="text/css">
+ body {
+ font-family: Arial;
+ }
+ .register_form_box {
+ padding: 10px;
+ padding-bottom: 40px;
+ margin: auto;
+ margin-top: 30px;
+ width: 40%;
+ border: 1px solid #000;
+ text-align: center;
+ }
+ #register_table {
+ padding: 10px;
+ margin: auto;
+ width: 90%;
+ text-align: left;
+ }
+</style>
+<script type="text/javascript">
+ function get_eid(id) {
+ return document.getElementById(id);
+ }
+
+ function do_register() {
+ let json = {
+ name: get_eid("nama").value.trim(),
+ email: get_eid("email").value.trim(),
+ /*
+ * Do not trim password, it should be stored as
+ * what it is actually written by the user.
+ */
+ password: get_eid("password").value,
+ cpassword: get_eid("cpassword").value,
+ };
+
+ let xhr = new XMLHttpRequest();
+ xhr.open("POST", "/auth/register");
+ xhr.setRequestHeader("Content-type", "application/json");
+ xhr.send(JSON.stringify(json));
+ }
+ get_eid("register_form").addEventListener("submit", do_register);
+</script>
+</body>
+</html>
--
Alviro Iskandar Setiawan
next prev parent reply other threads:[~2022-05-27 20:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-27 20:34 [PATCH buubuu v1 0/5] Login and Register page Alviro Iskandar Setiawan
2022-05-27 20:39 ` Alviro Iskandar Setiawan [this message]
2022-05-27 20:39 ` [PATCH buubuu v1 2/5] view: Create login.html Alviro Iskandar Setiawan
2022-05-27 20:39 ` [PATCH buubuu v1 3/5] auth-controller: Register: Render register.html on HTTP GET request Alviro Iskandar Setiawan
2022-05-27 20:39 ` [PATCH buubuu v1 4/5] auth-controller: Login: Render login.html " Alviro Iskandar Setiawan
2022-05-27 20:39 ` [PATCH buubuu v1 5/5] server: auth: Create `/login` route Alviro Iskandar Setiawan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220527203920.2474126-1-alviro.iskandar@gnuweeb.org \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox