propro-utils 1.4.16 → 1.4.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/server/index.js +20 -1
package/package.json
CHANGED
package/src/server/index.js
CHANGED
|
@@ -150,7 +150,16 @@ function proproAuthMiddleware(options = {}, userSchema) {
|
|
|
150
150
|
|
|
151
151
|
console.log('redirectUrl', redirectUrl);
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
let urlToRedirect;
|
|
154
|
+
|
|
155
|
+
if (!redirectUrl.startsWith('http://') && !redirectUrl.startsWith('https://')) {
|
|
156
|
+
if (redirectUrl.includes('localhost')) {
|
|
157
|
+
urlToRedirect = `http://${redirectUrl}`;
|
|
158
|
+
} else {
|
|
159
|
+
urlToRedirect = `https://${redirectUrl}`;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
154
163
|
|
|
155
164
|
console.log('urlToRedirect', urlToRedirect);
|
|
156
165
|
|
|
@@ -174,7 +183,17 @@ function proproAuthMiddleware(options = {}, userSchema) {
|
|
|
174
183
|
*/
|
|
175
184
|
function constructRedirectUrl(clientUrl, appName, clientId, redirectUri) {
|
|
176
185
|
console.log('constructRedirectUrl', clientUrl, appName, clientId, redirectUri);
|
|
186
|
+
|
|
187
|
+
if (!clientUrl.startsWith('http://') && !clientUrl.startsWith('https://')) {
|
|
188
|
+
if (clientUrl.includes('localhost')) {
|
|
189
|
+
clientUrl = `http://${clientUrl}`;
|
|
190
|
+
} else {
|
|
191
|
+
clientUrl = `https://${clientUrl}`;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
177
195
|
return `${clientUrl}/signin?response_type=code&appName=${appName}&client_id=${clientId}&redirect_uri=${encodeURIComponent(redirectUri)}`;
|
|
178
196
|
}
|
|
179
197
|
|
|
198
|
+
|
|
180
199
|
module.exports = proproAuthMiddleware;
|