GNU/Weeb Mailing List <[email protected]>
 help / color / mirror / Atom feed
From: Memet Zx <[email protected]>
To: Ammar Faizi <[email protected]>
Cc: Memet Zx <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>,
	Memet Zx <[email protected]>
Subject: [PATCH gwspamd 3/3] gwspamd: web: Refactor Password Update Page
Date: Sat, 29 Apr 2023 02:34:58 +0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

This commit refactors the UI of the password change form to improve
readability and adds a success modal instead of an alert when the
password is successfully updated. It also replaces the error alert with
a toast message to provide a better user experience.

Signed-off-by: Memet Zx <[email protected]>
---
 web/views/pages/settings/password.php | 52 +++++++++++++--------------
 1 file changed, 24 insertions(+), 28 deletions(-)

diff --git a/web/views/pages/settings/password.php b/web/views/pages/settings/password.php
index 95dda10..ebe9f6e 100644
--- a/web/views/pages/settings/password.php
+++ b/web/views/pages/settings/password.php
@@ -1,28 +1,21 @@
-<div class="content">
-	<div class="mw-full d-flex justify-content-center">
-		<form action="api.php?action=settings&amp;section=password" method="POST" id="change-pass-form" class="w-400 mw-full form-inline">
-			<table id="user-info" class="table">
-				<tr>
-					<th>
-						<div>Change Password</div>
-					</th>
-				</tr>
-				<tr>
-					<td>Current Password</td>
-					<td><input type="password" class="form-control" name="current_password" placeholder="Current Password" required /></td>
-				</tr>
-				<tr>
-					<td>New Password</td>
-					<td><input type="password" class="form-control" name="new_password" placeholder="New Password" required /></td>
-				</tr>
-				<tr>
-					<td>Confirm New Password</td>
-					<td><input type="password" class="form-control" name="confirm_new_password" placeholder="Confirm New Password" required /></td>
-				</tr>
-			</table>
-			<input class="btn btn-primary btn-block" type="submit" value="Save" />
-		</form>
-	</div>
+<h2 class="content-title">Update Password</h2>
+<hr />
+<div class="mw-full w-400">
+	<form action="api.php?action=settings&amp;section=password" method="POST" id="change-pass-form">
+		<div class="form-group">
+		  <label for="current_password" class="required">Current Password</label>
+		  <input type="password" class="form-control" id="password" name="current_password" placeholder="Current Password" required="required"/>
+		</div>
+		<div class="form-group">
+		  <label for="new_password" class="required">New Password</label>
+		  <input type="password" class="form-control" name="new_password" id="new_password" placeholder="New Password" required="required"/>
+		</div>
+		<div class="form-group">
+		  <label for="confirm_new_password" class="required">Confirm New Password</label>
+		  <input type="password" class="form-control" id="confirm_new_password" name="confirm_new_password" placeholder="Confirm New Password" required="required"/>
+		</div>
+		<input class="btn btn-primary" type="submit" value="Save" />
+	</form>
 </div>
 <script>
 	let form_password = gid("change-pass-form");
@@ -42,10 +35,13 @@
 			}
 
 			if (this.status == 200) {
-				alert("Password updated!");
-				window.location = "?ref=settings";
+				halfmoon.toggleModal('modal-success')
 			} else {
-				alert(res.error || "Unknown error");
+				if (res.error) {
+					toastErorrAlert(res.error);
+				} else {
+					toastErorrAlert("Unknown error");
+				}
 				toggle_all_inputs(true);
 			}
 		};
-- 
Memet Zx


  parent reply	other threads:[~2023-04-28 19:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-28 19:34 [PATCH gwspamd 0/3] Refactor Settings Page Layout, Profile Update, and Password Update Memet Zx
2023-04-28 19:34 ` [PATCH gwspamd 1/3] gwspamd: web: Refactor Settings Page Layout and UI Memet Zx
2023-04-28 19:34 ` [PATCH gwspamd 2/3] gwspamd: web: Refactor Profile Update Page Memet Zx
2023-04-28 19:34 ` Memet Zx [this message]
2023-04-29  3:34 ` [PATCH gwspamd 0/3] Refactor Settings Page Layout, Profile Update, and Password Update Ammar Faizi

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 \
    [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