mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-31 15:09:32 +00:00
v3: support party invitation from email
This commit is contained in:
parent
d1f9e9e7ca
commit
2f934455ad
2 changed files with 11 additions and 3 deletions
|
|
@ -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},
|
||||
|
|
|
|||
Loading…
Reference in a new issue