Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent setup wizard redirects #10811

Merged
merged 3 commits into from
May 18, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/rocketchat-lib/server/lib/metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ RocketChat.metrics.meteorSubscriptions = new client.Summary({
});

RocketChat.metrics.messagesSent = new client.Counter({'name': 'rocketchat_message_sent', 'help': 'cumulated number of messages sent'});
RocketChat.metrics.notificationsSent = new client.Counter({'name': 'rocketchat_notification_sent', labelNames: ['type'], 'help': 'cumulated number of notifications sent'});
RocketChat.metrics.notificationsSent = new client.Counter({'name': 'rocketchat_notification_sent', labelNames: ['notification_type'], 'help': 'cumulated number of notifications sent'});

RocketChat.metrics.ddpSessions = new client.Gauge({'name': 'rocketchat_ddp_sessions_count', 'help': 'number of open ddp sessions'});
RocketChat.metrics.ddpAthenticatedSessions = new client.Gauge({'name': 'rocketchat_ddp_sessions_auth', 'help': 'number of authenticated open ddp sessions'});
Expand Down
38 changes: 30 additions & 8 deletions packages/rocketchat-setup-wizard/client/setupWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,22 @@ const setSettingsAndGo = (settings, registerServer = true) => {

Template.setupWizard.onCreated(function() {
const userId = Meteor.userId();
const Show_Setup_Wizard = RocketChat.settings.get('Show_Setup_Wizard');

if (!userId || Show_Setup_Wizard === 'completed' || !RocketChat.authz.hasRole(userId, 'admin')) {
FlowRouter.go('home');
}
this.autorun((c) => {
const Show_Setup_Wizard = RocketChat.settings.get('Show_Setup_Wizard');
const user = Meteor.user();

// Wait for roles and setup wizard setting
if ((userId && (!user || !user.status)) || !Show_Setup_Wizard) {
return;
}

c.stop();

if ((!userId && Show_Setup_Wizard !== 'pending') || Show_Setup_Wizard === 'completed' || (userId && !RocketChat.authz.hasRole(userId, 'admin'))) {
FlowRouter.go('home');
}
});

if (localStorage.getItem('wizardFinal')) {
FlowRouter.go('setup-wizard-final');
Expand Down Expand Up @@ -253,11 +264,22 @@ Template.setupWizard.helpers({
Template.setupWizardFinal.onCreated(function() {
this.autorun(() => {
const userId = Meteor.userId();
const Show_Setup_Wizard = RocketChat.settings.get('Show_Setup_Wizard');

if (!userId || Show_Setup_Wizard === 'completed' || !RocketChat.authz.hasRole(userId, 'admin')) {
FlowRouter.go('home');
}
this.autorun((c) => {
const Show_Setup_Wizard = RocketChat.settings.get('Show_Setup_Wizard');
const user = Meteor.user();

// Wait for roles and setup wizard setting
if ((userId && (!user || !user.status)) || !Show_Setup_Wizard) {
return;
}

c.stop();

if ((!userId && Show_Setup_Wizard !== 'pending') || Show_Setup_Wizard === 'completed' || (userId && !RocketChat.authz.hasRole(userId, 'admin'))) {
FlowRouter.go('home');
}
});
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
justify-content: center;

&-info {
flex: 0 0 auto;
flex: 0 1 auto;

margin: 55px 65px 30px 80px;

Expand Down