Skip to content

Commit

Permalink
[IMPROVE] Setup Wizard username validation, step progress and optin/o…
Browse files Browse the repository at this point in the history
…ptout (#11254)

Closes #11198 

- [x] Show all steps on info box
- [x] Properly display errors in registration process of admin user
- [x] Break steps in subtemplates
- [x] Redesign "Register Server" step
      ![Register Server](https://user-images.githubusercontent.com/2263066/42013253-cd691bc2-7a72-11e8-8832-fe9ccd9e89b4.png)
- [x] Update end-to-end tests
  • Loading branch information
tassoevan authored and ggazzo committed Jul 3, 2018
1 parent 8b908ba commit c37a90a
Show file tree
Hide file tree
Showing 12 changed files with 713 additions and 436 deletions.
14 changes: 14 additions & 0 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@
"Allow_Invalid_SelfSigned_Certs": "Allow Invalid Self-Signed Certs",
"Allow_Invalid_SelfSigned_Certs_Description": "Allow invalid and self-signed SSL certificate's for link validation and previews.",
"Allow_switching_departments": "Allow Visitor to Switch Departments",
"Allow_Marketing_Emails": "Allow Marketing Emails",
"Alphabetical": "Alphabetical",
"Always_open_in_new_window": "Always Open in New Window",
"Analytics_features_enabled": "Features Enabled",
Expand Down Expand Up @@ -1370,6 +1371,7 @@
"InternalHubot_Username_Description": "This must be a valid username of a bot registered on your server.",
"Invalid_confirm_pass": "The password confirmation does not match password",
"Invalid_email": "The email entered is invalid",
"Invalid_username": "The username entered is invalid",
"Invalid_Export_File": "The file uploaded isn't a valid %s export file.",
"Invalid_Import_File_Type": "Invalid Import file type.",
"Invalid_name": "The name must not be empty",
Expand Down Expand Up @@ -2035,6 +2037,17 @@
"Regenerate_codes": "Regenerate codes",
"Register": "Register a new account",
"Register_Server": "Register Server",
"Register_Server_Info": "Use the preconfigured gateways and proxies provided by Rocket.Chat Technologies Corp.",
"Register_Server_Registered": "Register to access",
"Register_Server_Registered_Push_Notifications": "Mobile push notifications gateway",
"Register_Server_Registered_Livechat": "Livechat omnichannel proxy",
"Register_Server_Registered_OAuth": "OAuth proxy for social network",
"Register_Server_Registered_Marketplace": "Apps Marketplace",
"Register_Server_Opt_In": "Newsletter, offers and product updates",
"Register_Server_Standalone": "Keep standalone, you'll need to",
"Register_Server_Standalone_Service_Providers": "Create accounts with service providers",
"Register_Server_Standalone_Update_Settings": "Update the preconfigured settings",
"Register_Server_Standalone_Own_Certificates": "Recompile the mobile apps with your own certificates",
"Registration": "Registration",
"Registration_Succeeded": "Registration Succeeded",
"Registration_via_Admin": "Registration via Admin",
Expand Down Expand Up @@ -2215,6 +2228,7 @@
"Shared_Location": "Shared Location",
"Should_be_a_URL_of_an_image": "Should be a URL of an image.",
"Should_exists_a_user_with_this_username": "The user must already exist.",
"Show_Setup_Wizard": "Show Setup Wizard",
"Show_agent_email": "Show agent email",
"Show_all": "Show All",
"Show_Avatars": "Show Avatars",
Expand Down
3 changes: 3 additions & 0 deletions packages/rocketchat-lib/server/startup/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2902,6 +2902,9 @@ RocketChat.settings.addGroup('Setup_Wizard', function() {
order: 2
}
});
this.add('Allow_Marketing_Emails', true, {
type: 'boolean'
});
});
});

Expand Down
18 changes: 18 additions & 0 deletions packages/rocketchat-setup-wizard/client/final.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template name="setupWizardFinal">
<div class="setup-wizard">
<div class="setup-wizard-final">
<header class="setup-wizard-info__header setup-wizard-final__header">
<img class="setup-wizard-info__header-logo" src="images/logo/logo-black.svg">
</header>
<main class="setup-wizard-final__box">
<span class="setup-wizard-forms__header-step">{{_ "Launched_successfully"}}</span>
<h1 class="setup-wizard-info__content-title setup-wizard-final__box-title">{{_ "Your_workspace_is_ready"}}</h1>
<span class="setup-wizard-final__link-text">{{_ "Your_server_link"}}</span>
<span class="setup-wizard-final__link">{{siteUrl}}</span>
<button class="rc-button rc-button--primary js-finish">
<span>{{_ "Go_to_your_workspace"}}</span>
</button>
</main>
</div>
</div>
</template>
51 changes: 51 additions & 0 deletions packages/rocketchat-setup-wizard/client/final.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Template.setupWizardFinal.onCreated(function() {
const isSetupWizardDone = localStorage.getItem('wizardFinal');
if (isSetupWizardDone === null) {
FlowRouter.go('setup-wizard');
}

this.autorun(c => {
const showSetupWizard = RocketChat.settings.get('Show_Setup_Wizard');
if (!showSetupWizard) {
// Setup Wizard state is not defined yet
return;
}

const userId = Meteor.userId();
const user = userId && RocketChat.models.Users.findOne(userId, { fields: { status: true } });
if (userId && (!user || !user.status)) {
// User and its status are not defined yet
return;
}

c.stop();

const isComplete = showSetupWizard === 'completed';
const noUserLoggedInAndIsNotPending = !userId && showSetupWizard !== 'pending';
const userIsLoggedButIsNotAdmin = userId && !RocketChat.authz.hasRole(userId, 'admin');
if (isComplete || noUserLoggedInAndIsNotPending || userIsLoggedButIsNotAdmin) {
FlowRouter.go('home');
return;
}
});
});

Template.setupWizardFinal.onRendered(function() {
$('#initial-page-loading').remove();
});

Template.setupWizardFinal.events({
'click .js-finish'() {
RocketChat.settings.set('Show_Setup_Wizard', 'completed', function() {
localStorage.removeItem('wizard');
localStorage.removeItem('wizardFinal');
FlowRouter.go('home');
});
}
});

Template.setupWizardFinal.helpers({
siteUrl() {
return RocketChat.settings.get('Site_Url');
}
});
Loading

0 comments on commit c37a90a

Please sign in to comment.