Started work on URL-Token based password reset system. Email not yet implemented.

This commit is contained in:
rainbow napkin 2024-12-28 04:30:08 -05:00
parent 8ee92541de
commit ed698f40c7
22 changed files with 580 additions and 16 deletions

View file

@ -0,0 +1,54 @@
<!--Canopy - The next generation of stoner streaming software
Copyright (C) 2024 Rainbownapkin and the TTN Community
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.-->
<!DOCTYPE html>
<html>
<head>
<%- include('partial/styles', {instance, user}); %>
<link rel="stylesheet" type="text/css" href="/css/passwordReset.css">
<link rel="stylesheet" type="text/css" href="/lib/altcha/altcha.css">
<title><%= instance %></title>
</head>
<body>
<%- include('partial/navbar', {user}); %>
<h3>Password Reset</h3>
<!-- if we received a valid reset token -->
<% if(token != null){ %>
<p>Enter new password below.</p>
<form action="javascript:">
<label>New Password:</label>
<input class="reset-pass-prompt" id="reset-pass-prompt" type="password">
<label>Confirm New Password:</label>
<input class="reset-pass-prompt" id="reset-pass-confirm-prompt" type="password">
<altcha-widget floating challengejson="<%= JSON.stringify(challenge) %>"></altcha-widget>
<button id="reset-pass-button" class='positive-button'>Change Password</button>
</form>
<!-- Otherwise -->
<% }else{ %>
<p>Enter username to initiate password reset.</p>
<form action="javascript:">
<label>Username:</label>
<input class="reset-pass-prompt" id="reset-pass-username-prompt" placeholder="username">
<altcha-widget floating challengejson="<%= JSON.stringify(challenge) %>"></altcha-widget>
<button id="reset-pass-button" class='positive-button'>Send Email</button>
</form>
<% } %>
</body>
<footer>
<%- include('partial/scripts', {user}); %>
<script src="/lib/altcha/altcha.js" type="module"></script>
<script src="/js/passwordReset.js"></script>
</footer>
</html>