Compare commits

..

4 Commits

Author SHA1 Message Date
Matteo Pagliazzi 27263e9b2f 4.140.8 2020-04-18 17:41:40 +02:00
Matteo Pagliazzi 2d9715b657 fix(apple auth): add needed env var to client and encode redirect url 2020-04-18 17:41:25 +02:00
Matteo Pagliazzi 9f9da5632d 4.140.7 2020-04-18 16:02:23 +02:00
Matteo Pagliazzi 9364cdc2b4 fix(apple auth): do not try to parse name if it is missing, add query parameters to logs 2020-04-18 16:02:18 +02:00
7 changed files with 10 additions and 5 deletions
+1
View File
@@ -12,6 +12,7 @@ ENV GOOGLE_CLIENT_ID 1035232791481-32vtplgnjnd1aufv3mcu1lthf31795fq.apps.googleu
ENV LOGGLY_CLIENT_TOKEN ab5663bf-241f-4d14-8783-7d80db77089a
ENV NODE_ENV production
ENV STRIPE_PUB_KEY pk_85fQ0yMECHNfHTSsZoxZXlPSwSNfA
ENV APPLE_AUTH_CLIENT_ID 9Q9SMRMCNN.com.habitrpg.ios.Habitica
# Install global packages
RUN npm install -g gulp-cli mocha
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "habitica",
"version": "4.140.6",
"version": "4.140.8",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "habitica",
"description": "A habit tracker app which treats your goals like a Role Playing Game.",
"version": "4.140.6",
"version": "4.140.8",
"main": "./website/server/index.js",
"dependencies": {
"@babel/core": "^7.9.0",
@@ -170,6 +170,7 @@ describe('errorHandler', () => {
originalUrl: req.originalUrl,
headers: req.headers,
body: req.body,
query: req.query,
httpCode: 400,
isHandledError: true,
});
+1 -1
View File
@@ -23,6 +23,6 @@ export function setUpAxios (AUTH_SETTINGS) { // eslint-disable-line import/prefe
}
export function buildAppleAuthUrl () {
const redirectUrl = `${window.location.protocol}//${window.location.host}/api/v4/user/auth/apple`;
const redirectUrl = encodeURIComponent(`${window.location.protocol}//${window.location.host}/api/v4/user/auth/apple`);
return `https://appleid.apple.com/auth/authorize?response_mode=form_post&scope=name%20email&response_type=code&version=2&redirect_uri=${redirectUrl}&client_id=${process.env.APPLE_AUTH_CLIENT_ID}`;
}
+4 -2
View File
@@ -160,8 +160,10 @@ api.redirectApple = {
}
let url = `/static/apple-redirect?code=${req.body.code}`;
if (req.body.user) {
const { name } = JSON.parse(req.body.user);
url += `&name=${name.firstName} ${name.lastName}`;
const parsedBody = JSON.parse(req.body.user);
if (parsedBody && parsedBody.name) {
url += `&name=${parsedBody.name.firstName} ${parsedBody.name.lastName}`;
}
}
return res.redirect(303, url);
},
@@ -69,6 +69,7 @@ export default function errorHandler (err, req, res, next) { // eslint-disable-l
// don't send sensitive information that only adds noise
headers: omit(req.headers, ['x-api-key', 'cookie', 'password', 'confirmPassword']),
body: omit(req.body, ['password', 'confirmPassword']),
query: omit(req.query, ['password', 'confirmPassword']),
httpCode: responseErr.httpCode,
isHandledError: responseErr.httpCode < 500,