aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-06-03 16:54:52 +0530
committerBobby <[email protected]>2022-06-03 16:54:52 +0530
commit692eecf32e4d569a55de2c4b5abb6a6897c88abe (patch)
tree9575c0f7dbe31a8e4e064a6bc02e0ed7510ebc8d /views
parent34407aa326383b641609e1effa39418341b740c0 (diff)
downloadthatcomputerscientist-692eecf32e4d569a55de2c4b5abb6a6897c88abe.tar.xz
thatcomputerscientist-692eecf32e4d569a55de2c4b5abb6a6897c88abe.zip
password change function
Diffstat (limited to 'views')
-rw-r--r--views/account.ejs18
-rw-r--r--views/error.ejs14
2 files changed, 25 insertions, 7 deletions
diff --git a/views/account.ejs b/views/account.ejs
index cc100875..f3bc3359 100644
--- a/views/account.ejs
+++ b/views/account.ejs
@@ -17,14 +17,20 @@
<legend>Avatar</legend>
<img src="https://www.gravatar.com/avatar/<%= user.avatar %>?s=200" alt="<%= user.username %>'s avatar" />
</fieldset>
- <form method="post" onsubmit="event.preventDefault();">
+ <form method="post" action="/auth/changePassword">
<fieldset>
<legend>Change Password</legend>
- <label for="password">New Password</label>
- <input type="password" name="password" id="password" placeholder="New Password" />
- <label for="password_confirm">Confirm Password</label>
- <input type="password" name="password_confirm" id="password_confirm" placeholder="Confirm Password" />
+ <label for="password">Current Password</label>
+ <input type="password" name="password" id="password" placeholder="Current Password" />
+ <label for="new_password">New Password</label>
+ <input type="password" name="new_password" id="new_password" placeholder="New Password" />
<input type="submit" value="Change Password" />
+ <% if (locals.messages.passchangesuccess) { %>
+ <p class="success"><%= messages.passchangesuccess %></p>
+ <% } %>
+ <% if (locals.messages.passchangeerror) { %>
+ <p class="error"><%= messages.passchangeerror %></p>
+ <% } %>
</fieldset>
</form>
<form method="post" onsubmit="event.preventDefault();">
@@ -61,8 +67,6 @@
</div>
</div>
<script>
- var user = '<%- JSON.stringify(user) %>';
- console.log(JSON.parse(user));
document.getElementById('accountURL').innerHTML = window.location.origin + '/profile/<%= user.username %>';
</script>
diff --git a/views/error.ejs b/views/error.ejs
new file mode 100644
index 00000000..d11cc4be
--- /dev/null
+++ b/views/error.ejs
@@ -0,0 +1,14 @@
+<%- include('partials/header.ejs') %> <%- include('partials/sidebar.ejs') %>
+<div class="main">
+ <div class="alert">
+ <h1 class="error">error</h1>
+ <p>
+ <%= error %>
+ </p>
+ </div>
+ <section>
+ <h2>Recent Posts</h2>
+ </section>
+</div>
+
+<%- include('partials/footer.ejs') %>