Skip to content

Commit 2dca71f

Browse files
authored
Partial new user propagation (#1939)
Post #1938 #1937 #1446 #1470 ... #944 Auto-merge
1 parent ade240a commit 2dca71f

4 files changed

Lines changed: 13 additions & 8 deletions

File tree

controllers/auth.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ exports.preauth = function (aReq, aRes, aNext) {
122122
// Match cleansed name and this is the casing they have chosen
123123
aReq.body.username = username;
124124

125+
aReq.newUser = true;
126+
125127
// Validate captcha for unknown individual
126128
if (!SITEKEY) {
127129
// Skip captcha for not implemented
@@ -206,9 +208,11 @@ exports.auth = function (aReq, aRes, aNext) {
206208
aReq.session.redirectTo = '/';
207209
}
208210

209-
// Save the known user on the session and remove
211+
// Save the known statuses of the user on the session and remove
210212
aReq.session.wellKnownUser = aReq.wellKnownUser;
213+
aReq.session.newUser = aReq.newUser;
211214
delete aReq.wellKnownUser;
215+
delete aReq.newUser;
212216

213217
// Save the token from the captcha on the session and remove from body
214218
if (captchaToken) {

controllers/user.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,10 @@ exports.destroyOne = function (aReq, aRes, aNext) {
261261

262262
destroyOneSession(aReq, authedUser.isAdmin, user, id, function (aErr) {
263263
if (aErr) {
264-
statusCodePage(aReq, aRes, aNext, {
265-
statusCode: aErr.code || 500,
266-
statusMessage: aErr.message
267-
});
264+
// NOTE: Watchpoint
265+
redirectTo.search = (redirectTo.search ? redirectTo.search + '&' : '') +
266+
'curses';
267+
aRes.redirect(redirectTo);
268268
return;
269269
}
270270

libs/modifySessions.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,15 @@ exports.destroyOne = function (aReq, aSkipUserCheck, aUser, aId, aCallback) {
199199
console.log(
200200
'`' + authedUser.name + '`',
201201
'removed a session id of',
202-
'`' + aId + '`',
202+
'`' + aId + '`', 'for `' + aSess.username + '`',
203203
(aSess.passport && aSess.passport.oujsOptions && aSess.passport.oujsOptions.authFrom
204204
? 'authed from `' + aSess.passport.oujsOptions.authFrom + '`'
205205
: '')
206206
);
207207
} else if (authedUser.name !== aUser.name) {
208208
console.log(
209209
'`' + authedUser.name + '`',
210-
'removed a session by',
210+
'removed a session for',
211211
'`' + aUser.name + '`',
212212
(aSess.passport && aSess.passport.oujsOptions && aSess.passport.oujsOptions.authFrom
213213
? 'authed from `' + aSess.passport.oujsOptions.authFrom + '`'
@@ -331,6 +331,7 @@ exports.findSessionData = function (aQuery, aStore, aOptions, aCallback) {
331331

332332

333333
data.passport.oujsOptions.username = data.username || findMeta(data.user, 'name');
334+
data.passport.oujsOptions.newUser = data.newUser;
334335
data.passport.oujsOptions.sid = aSessionData._id;
335336

336337
// Very simple query filter search check to start.

views/includes/session.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<div class="names pull-left">
1111
<span>
1212
{{#user.userPageUrl}}<a href="{{{user.userPageUrl}}}" class="username">{{name}}</a>{{/user.userPageUrl}}
13-
{{^user.userPageUrl}}<span class="username">{{#name}}{{name}}{{/name}}{{^name}}<em>&hellip;</em>{{/name}}</span>{{/user.userPageUrl}}
13+
{{^user.userPageUrl}}<span class="username">{{#passport.oujsOptions.newUser}}<em>{{/passport.oujsOptions.newUser}}{{#name}}{{name}}{{/name}}{{#passport.oujsOptions.newUser}}</em>{{/passport.oujsOptions.newUser}}{{^name}}<em>&hellip;</em>{{/name}}</span>{{/user.userPageUrl}}
1414
<span class="label label-default">{{#user.roleName}}{{user.roleName}}{{/user.roleName}}{{^user.roleName}}<em>&hellip;</em>{{/user.roleName}}</span>
1515
<span class="label label-{{#cookie.secure}}success{{/cookie.secure}}{{^cookie.secure}}warning{{/cookie.secure}}" title="secure">
1616
<i class="fa fa-{{^cookie.secure}}un{{/cookie.secure}}lock"></i>

0 commit comments

Comments
 (0)