Updated server-side self-refrencing links to only use port when not reverse proxied.

This commit is contained in:
rainbow napkin 2025-04-26 19:14:10 -04:00
parent af982f8611
commit 46a7e9e067
3 changed files with 3 additions and 2 deletions

View file

@ -2,6 +2,7 @@
"instanceName": "Canopy", "instanceName": "Canopy",
"verbose": false, "verbose": false,
"port": 8080, "port": 8080,
"proxied": false,
"protocol": "http", "protocol": "http",
"domain": "localhost", "domain": "localhost",
"sessionSecret": "CHANGE_ME", "sessionSecret": "CHANGE_ME",

View file

@ -134,7 +134,7 @@ emailChangeSchema.methods.consume = async function(){
emailChangeSchema.methods.getChangeURL = function(){ emailChangeSchema.methods.getChangeURL = function(){
//Check for default port based on protocol //Check for default port based on protocol
if((config.protocol == 'http' && config.port == 80) || (config.protocol == 'https' && config.port == 443)){ if((config.protocol == 'http' && config.port == 80) || (config.protocol == 'https' && config.port == 443 || config.proxied)){
//Return path //Return path
return `${config.protocol}://${config.domain}/emailChange?token=${this.token}`; return `${config.protocol}://${config.domain}/emailChange?token=${this.token}`;
}else{ }else{

View file

@ -106,7 +106,7 @@ passwordResetSchema.methods.consume = async function(pass, confirmPass){
passwordResetSchema.methods.getResetURL = function(){ passwordResetSchema.methods.getResetURL = function(){
//Check for default port based on protocol //Check for default port based on protocol
if((config.protocol == 'http' && config.port == 80) || (config.protocol == 'https' && config.port == 443)){ if((config.protocol == 'http' && config.port == 80) || (config.protocol == 'https' && config.port == 443) || config.proxied){
//Return path //Return path
return `${config.protocol}://${config.domain}/passwordReset?token=${this.token}`; return `${config.protocol}://${config.domain}/passwordReset?token=${this.token}`;
}else{ }else{