-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMPROVE] Setup Wizard username validation, step progress and optin/o…
…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
Showing
12 changed files
with
713 additions
and
436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
} | ||
}); |
Oops, something went wrong.