Skip to content

Commit d8d233b

Browse files
committed
Rename method for building link and pass config to it.
1 parent 56d76f1 commit d8d233b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Controllers/UserController.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export class UserController extends AdaptableController {
120120
// We may need to fetch the user in case of update email
121121
this.getUserIfNeeded(user).then((user) => {
122122
const username = encodeURIComponent(user.username);
123-
let link = buildVerificationLink(this.config.verifyEmailURL, username, token);
123+
let link = buildEmailLink(this.config.verifyEmailURL, username, token, this.config);
124124
let options = {
125125
appName: this.config.appName,
126126
link: link,
@@ -156,7 +156,7 @@ export class UserController extends AdaptableController {
156156
const token = encodeURIComponent(user._perishable_token);
157157
const username = encodeURIComponent(user.username);
158158

159-
let link = buildVerificationLink(this.config.requestResetPasswordURL, username, token);
159+
let link = buildEmailLink(this.config.requestResetPasswordURL, username, token, this.config);
160160
let options = {
161161
appName: this.config.appName,
162162
link: link,
@@ -217,12 +217,12 @@ function updateUserPassword(userId, password, config) {
217217
});
218218
}
219219

220-
function buildVerificationLink(destination, username, token) {
220+
function buildEmailLink(destination, username, token, config) {
221221
let usernameAndToken = `token=${token}&username=${username}`
222222

223-
if (this.config.parseFrameURL) {
224-
let destinationWithoutHost = destination.replace(this.config.publicServerURL, '');
225-
return `${this.config.parseFrameURL}?link=${encodeURIComponent(destinationWithoutHost)}&${usernameAndToken}`;
223+
if (config.parseFrameURL) {
224+
let destinationWithoutHost = destination.replace(config.publicServerURL, '');
225+
return `${config.parseFrameURL}?link=${encodeURIComponent(destinationWithoutHost)}&${usernameAndToken}`;
226226
} else {
227227
return `${destination}?${usernameAndToken}`;
228228
}

0 commit comments

Comments
 (0)