mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
v3: support party invitation from email
This commit is contained in:
@@ -31,7 +31,7 @@ angular.module('habitrpg')
|
||||
} else if (status === 400 && data.errors && _.isArray(data.errors)) { // bad requests
|
||||
data.errors.forEach(function (err) {
|
||||
$window.alert(err.message);
|
||||
});
|
||||
});
|
||||
} else if (!!data && !!data.error) {
|
||||
$window.alert(data.message);
|
||||
} else {
|
||||
@@ -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);
|
||||
|
||||
@@ -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},
|
||||
|
||||
Reference in New Issue
Block a user