Started work on migration UI. Improved email handling.
This commit is contained in:
parent
bddbd9cd36
commit
eb48b92551
9 changed files with 252 additions and 23 deletions
31
www/css/migrate.css
Normal file
31
www/css/migrate.css
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 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/>.*/
|
||||
form{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 0.5em;
|
||||
margin: 5% 17%;
|
||||
}
|
||||
|
||||
.migrate-prompt{
|
||||
width: 100%
|
||||
}
|
||||
|
||||
#migrate-button{
|
||||
width: 6em;
|
||||
height: 2em;
|
||||
}
|
||||
68
www/js/migrate.js
Normal file
68
www/js/migrate.js
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024-2025 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/>.*/
|
||||
|
||||
class migratePrompt{
|
||||
constructor(){
|
||||
//Grab user prompt
|
||||
this.user = document.querySelector("#migrate-username");
|
||||
//Grab pass prompts
|
||||
this.oldPass = document.querySelector("#migrate-password-old");
|
||||
this.pass = document.querySelector("#migrate-password");
|
||||
this.passConfirm = document.querySelector("#migrate-password-confirm");
|
||||
//Grab migrate button
|
||||
this.button = document.querySelector("#migrate-button");
|
||||
//Grab altcha widget
|
||||
this.altcha = document.querySelector("altcha-widget");
|
||||
//Setup null property to hold verification payload from altcha widget
|
||||
this.verification = null
|
||||
|
||||
//Run input setup after DOM content has completely loaded to ensure altcha event listeners work
|
||||
document.addEventListener('DOMContentLoaded', this.setupInput.bind(this));
|
||||
}
|
||||
|
||||
setupInput(){
|
||||
//Add verification event listener to altcha widget
|
||||
this.altcha.addEventListener("verified", this.verify.bind(this));
|
||||
|
||||
//Add migrate event listener to migrate button
|
||||
this.button.addEventListener("click", this.migrate.bind(this));
|
||||
}
|
||||
|
||||
verify(event){
|
||||
//pull verification payload from event
|
||||
this.verification = event.detail.payload;
|
||||
}
|
||||
|
||||
migrate(){
|
||||
//If altcha verification isn't complete
|
||||
if(this.verification == null){
|
||||
//don't bother
|
||||
return;
|
||||
}
|
||||
|
||||
//if the confirmation password doesn't match
|
||||
if(this.pass.value != this.passConfirm.value){
|
||||
//Scream and shout
|
||||
new canopyUXUtils.popup(`<p>Confirmation password does not match!</p>`);
|
||||
return;
|
||||
}
|
||||
|
||||
//Send the registration informaiton off to the server
|
||||
utils.ajax.migrate(this.user.value , this.oldPass.value, this.pass.value , this.passConfirm.value , this.verification);
|
||||
}
|
||||
}
|
||||
|
||||
const migrateForm = new migratePrompt();
|
||||
Loading…
Add table
Add a link
Reference in a new issue