Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit c9f041c

Browse files
Revert "Add state to the workflow" (#303)
* Revert "Use nanoid instead of cuid for oauth code (#302)" This reverts commit 7a64814. * Revert "Add state to the workflow (#301)" This reverts commit 764992d.
1 parent 7a64814 commit c9f041c

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

nodebb-api.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
'use strict';
22

33
var querystring = require('querystring');
4-
var http;
5-
if (process.env.NODE_ENV !== 'production') {
6-
http = require('http');
7-
} else {
8-
http = require('https');
9-
}
4+
var http = require('https');
105
var _ = require('lodash');
116
var util = require('util');
127

@@ -42,7 +37,6 @@ module.exports = function (options) {
4237
path: base_path + 'users/' + target_user + '/external?' + qs
4338
}, function (err, res) {
4439
if (err) return handleErr(err, done);
45-
if (!res.payload) return handleErr(new Error('unexpected error: ' + target_user + res), done);
4640
if (!res.payload.uid) return handleErr(new Error('user not found: ' + target_user), done);
4741
done(null, res.payload.uid);
4842
});
@@ -62,10 +56,8 @@ module.exports = function (options) {
6256
// email: '[email protected]'
6357
// });
6458

65-
var payload = { username: data.alias ? data.alias : data.name, uid: uid, email: data.email };
66-
if (data.uploadedpicture) payload.uploadedpicture = data.uploadedpicture;
67-
if (data.picture) payload.picture = data.picture;
68-
data = querystring.stringify(payload);
59+
data = querystring.stringify(data);
60+
6961
sendReq({
7062
path: base_path + 'users/' + target_user + '?_uid=' + querying_user,
7163
method: 'PUT',

oauth2.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ module.exports = function (options) {
138138
if (!args.user) {
139139
return done(null, {
140140
http$: {
141-
// Redirect to the start of the flow, get a new code + crsf token
142-
redirect: '/login?referer=' + encodeURIComponent(process.env.ADULT_FORUM + '/auth/CoderDojo')
141+
redirect: '/login?redirect=' + args.redirect_uri
143142
}
144143
});
145144
} else {
@@ -152,7 +151,7 @@ module.exports = function (options) {
152151
if (err) return done(null, {error: err, http$: {status: 500}});
153152
done(null, {
154153
http$: {
155-
redirect: args.redirect_uri + '?code=' + code + '&state=' + args.state
154+
redirect: args.redirect_uri + '?code=' + code
156155
}
157156
});
158157
});

profiles.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,8 @@ module.exports = function (options) {
557557
var forumProfile = _.clone(profile);
558558
forumProfile.username = forumProfile.name;
559559

560-
forumProfile.uploadedpicture = protocol + '://' + hostname + '/api/2.0/profiles/' + profile.id + '/avatar_img';
561-
forumProfile.picture = protocol + '://' + hostname + '/api/2.0/profiles/' + profile.id + '/avatar_img';
560+
forumProfile.uploadedpicture = protocol + '://' + hostname + '/api/1.0/profiles/' + profile.id + '/avatar_img';
561+
forumProfile.picture = protocol + '://' + hostname + '/api/1.0/profiles/' + profile.id + '/avatar_img';
562562

563563
seneca.act({role: 'cd-nodebb-api', cmd: 'update', user: forumProfile, id: forumProfile.userId}, function (err, res) {
564564
if (err) seneca.log.error(err);

0 commit comments

Comments
 (0)