v3: support party invitation from email

This commit is contained in:
Matteo Pagliazzi
2016-05-18 16:39:11 +02:00
parent d1f9e9e7ca
commit 2f934455ad
2 changed files with 11 additions and 3 deletions

View File

@@ -51,7 +51,15 @@ angular.module('habitrpg')
$scope.registrationInProgress = true;
var url = ApiUrl.get() + "/api/v3/user/auth/local/register";
if($rootScope.selectedLanguage) url = url + '?lang=' + $rootScope.selectedLanguage.code;
if (location.search && location.search.indexOf('Invite=') !== -1) { // matches groupInvite and partyInvite
url += location.search;
}
if($rootScope.selectedLanguage) {
var toAppend = url.indexOf('?') !== -1 ? '&' : '?';
url = url + toAppend + 'lang=' + $rootScope.selectedLanguage.code;
}
$http.post(url, scope.registerVals).success(function(res, status, headers, config) {
runAuth(res.data._id, res.data.apiToken);
}).error(errorAlert);

View File

@@ -568,7 +568,7 @@ async function _inviteByEmail (invite, group, inviter, req, res) {
inviter: inviter._id,
sentAt: Date.now(), // so we can let it expire
});
let link = `?groupInvite=${encrypt(groupQueryString)}`;
let link = `/static/front?groupInvite=${encrypt(groupQueryString)}`;
let variables = [
{name: 'LINK', content: link},