Finished up with email change backend. Just need to make a prompt on the profile page for our AJAX call.

This commit is contained in:
rainbow napkin 2024-12-30 09:43:25 -05:00
parent 4a865e8aa8
commit a51152a89d
14 changed files with 444 additions and 13 deletions

View file

@ -13,11 +13,34 @@ 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/>.*/
h1, h3{
div.error-body{
display: flex;
flex-direction: column;
}
.error-body h1,.error-body h2,.error-body a{
text-align: center;
}
img{
width: 50%;
margin: 0 auto;
.error-body h2,.error-body a{
margin: 0.5em;
}
.error-body h1{
font-size: 3em;
margin-top: 5%;
margin-bottom: 0.5em;
}
.error-body h2{
font-size: 2em;
}
.error-body a{
font-size: 1.2em;
}
.error-body img{
width: 75%;
margin: 3em auto;
}

View file

@ -534,6 +534,25 @@ class canopyAjaxUtils{
}
}
async requestEmailChange(email, pass){
const response = await fetch(`/api/account/emailChangeRequest`,{
method: "POST",
headers: {
"Content-Type": "application/json",
"x-csrf-token": utils.ajax.getCSRFToken()
},
body: JSON.stringify({email, pass})
});
//If we received a successful response
if(response.status == 200){
const popup = new canopyUXUtils.popup("A confirmation link has been sent to the new email address.");
//Otherwise
}else{
utils.ux.displayResponseError(await response.json());
}
}
//Channel
async newChannel(name, description, thumbnail, verification){
var response = await fetch(`/api/channel/register`,{