mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Fixed Disable Self-Registration. Added Disable Forgot Password to same Admin Panel page.
Thanks to xet7 ! Fixes #3971, fixes #2839
This commit is contained in:
parent
9ca8d78514
commit
b85db43c47
6 changed files with 74 additions and 4 deletions
|
@ -63,6 +63,11 @@ template(name="webhookSettings")
|
||||||
|
|
||||||
template(name="general")
|
template(name="general")
|
||||||
ul#registration-setting.setting-detail
|
ul#registration-setting.setting-detail
|
||||||
|
li
|
||||||
|
a.flex.js-toggle-forgot-password
|
||||||
|
.materialCheckBox(class="{{#if currentSetting.disableForgotPassword}}is-checked{{/if}}")
|
||||||
|
|
||||||
|
span {{_ 'disable-forgot-password'}}
|
||||||
li
|
li
|
||||||
a.flex.js-toggle-registration
|
a.flex.js-toggle-registration
|
||||||
.materialCheckBox(class="{{#if currentSetting.disableRegistration}}is-checked{{/if}}")
|
.materialCheckBox(class="{{#if currentSetting.disableRegistration}}is-checked{{/if}}")
|
||||||
|
|
|
@ -4,6 +4,7 @@ BlazeComponent.extendComponent({
|
||||||
onCreated() {
|
onCreated() {
|
||||||
this.error = new ReactiveVar('');
|
this.error = new ReactiveVar('');
|
||||||
this.loading = new ReactiveVar(false);
|
this.loading = new ReactiveVar(false);
|
||||||
|
this.forgotPasswordSetting = new ReactiveVar(true);
|
||||||
this.generalSetting = new ReactiveVar(true);
|
this.generalSetting = new ReactiveVar(true);
|
||||||
this.emailSetting = new ReactiveVar(false);
|
this.emailSetting = new ReactiveVar(false);
|
||||||
this.accountSetting = new ReactiveVar(false);
|
this.accountSetting = new ReactiveVar(false);
|
||||||
|
@ -56,6 +57,14 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
toggleForgotPassword() {
|
||||||
|
this.setLoading(true);
|
||||||
|
const forgotPasswordClosed = this.currentSetting().disableForgotPassword;
|
||||||
|
Settings.update(Settings.findOne()._id, {
|
||||||
|
$set: { disableForgotPassword: !forgotPasswordClosed },
|
||||||
|
});
|
||||||
|
this.setLoading(false);
|
||||||
|
},
|
||||||
toggleRegistration() {
|
toggleRegistration() {
|
||||||
this.setLoading(true);
|
this.setLoading(true);
|
||||||
const registrationClosed = this.currentSetting().disableRegistration;
|
const registrationClosed = this.currentSetting().disableRegistration;
|
||||||
|
@ -84,6 +93,7 @@ BlazeComponent.extendComponent({
|
||||||
$('.side-menu li.active').removeClass('active');
|
$('.side-menu li.active').removeClass('active');
|
||||||
target.parent().addClass('active');
|
target.parent().addClass('active');
|
||||||
const targetID = target.data('id');
|
const targetID = target.data('id');
|
||||||
|
this.forgotPasswordSetting.set('forgot-password-setting' === targetID);
|
||||||
this.generalSetting.set('registration-setting' === targetID);
|
this.generalSetting.set('registration-setting' === targetID);
|
||||||
this.emailSetting.set('email-setting' === targetID);
|
this.emailSetting.set('email-setting' === targetID);
|
||||||
this.accountSetting.set('account-setting' === targetID);
|
this.accountSetting.set('account-setting' === targetID);
|
||||||
|
@ -267,6 +277,7 @@ BlazeComponent.extendComponent({
|
||||||
events() {
|
events() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
'click a.js-toggle-forgot-password': this.toggleForgotPassword,
|
||||||
'click a.js-toggle-registration': this.toggleRegistration,
|
'click a.js-toggle-registration': this.toggleRegistration,
|
||||||
'click a.js-toggle-tls': this.toggleTLS,
|
'click a.js-toggle-tls': this.toggleTLS,
|
||||||
'click a.js-setting-menu': this.switchMenu,
|
'click a.js-setting-menu': this.switchMenu,
|
||||||
|
|
|
@ -1,5 +1,21 @@
|
||||||
const passwordField = AccountsTemplates.removeField('password');
|
const passwordField = AccountsTemplates.removeField('password');
|
||||||
const emailField = AccountsTemplates.removeField('email');
|
const emailField = AccountsTemplates.removeField('email');
|
||||||
|
let disableRegistration = true;
|
||||||
|
let disableForgotPassword = true;
|
||||||
|
|
||||||
|
Meteor.call('getDisableRegistration', (err, data) => {
|
||||||
|
if (!err) {
|
||||||
|
disableRegistration = data;
|
||||||
|
//console.log(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Meteor.call('getDisableForgotPassword', (err, data) => {
|
||||||
|
if (!err) {
|
||||||
|
disableForgotPassword = data;
|
||||||
|
//console.log(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
AccountsTemplates.addFields([
|
AccountsTemplates.addFields([
|
||||||
{
|
{
|
||||||
|
@ -27,7 +43,8 @@ AccountsTemplates.configure({
|
||||||
confirmPassword: true,
|
confirmPassword: true,
|
||||||
enablePasswordChange: true,
|
enablePasswordChange: true,
|
||||||
sendVerificationEmail: true,
|
sendVerificationEmail: true,
|
||||||
showForgotPasswordLink: true,
|
showForgotPasswordLink: !disableForgotPassword,
|
||||||
|
forbidClientAccountCreation: disableRegistration,
|
||||||
onLogoutHook() {
|
onLogoutHook() {
|
||||||
const homePage = 'home';
|
const homePage = 'home';
|
||||||
if (FlowRouter.getRouteName() === homePage) {
|
if (FlowRouter.getRouteName() === homePage) {
|
||||||
|
@ -38,11 +55,21 @@ AccountsTemplates.configure({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!disableForgotPassword) {
|
||||||
|
[
|
||||||
|
'forgotPwd',
|
||||||
|
'resetPwd',
|
||||||
|
].forEach(routeName => AccountsTemplates.configureRoute(routeName));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!disableRegistration) {
|
||||||
|
[
|
||||||
|
'signUp',
|
||||||
|
].forEach(routeName => AccountsTemplates.configureRoute(routeName));
|
||||||
|
}
|
||||||
|
|
||||||
[
|
[
|
||||||
'signIn',
|
'signIn',
|
||||||
'signUp',
|
|
||||||
'resetPwd',
|
|
||||||
'forgotPwd',
|
|
||||||
'enrollAccount',
|
'enrollAccount',
|
||||||
].forEach(routeName => AccountsTemplates.configureRoute(routeName));
|
].forEach(routeName => AccountsTemplates.configureRoute(routeName));
|
||||||
|
|
||||||
|
|
|
@ -610,6 +610,7 @@
|
||||||
"people": "People",
|
"people": "People",
|
||||||
"registration": "Registration",
|
"registration": "Registration",
|
||||||
"disable-self-registration": "Disable Self-Registration",
|
"disable-self-registration": "Disable Self-Registration",
|
||||||
|
"disable-forgot-password": "Disable Forgot Password",
|
||||||
"invite": "Invite",
|
"invite": "Invite",
|
||||||
"invite-people": "Invite People",
|
"invite-people": "Invite People",
|
||||||
"to-boards": "To board(s)",
|
"to-boards": "To board(s)",
|
||||||
|
|
|
@ -12,6 +12,9 @@ Settings.attachSchema(
|
||||||
disableRegistration: {
|
disableRegistration: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
},
|
},
|
||||||
|
disableForgotPassword: {
|
||||||
|
type: Boolean,
|
||||||
|
},
|
||||||
'mailServer.username': {
|
'mailServer.username': {
|
||||||
type: String,
|
type: String,
|
||||||
optional: true,
|
optional: true,
|
||||||
|
@ -435,6 +438,28 @@ if (Meteor.isServer) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getDisableRegistration() {
|
||||||
|
const setting = Settings.findOne({});
|
||||||
|
if (!setting.disableRegistration) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
disableRegistration: `${setting.disableRegistration}`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
getDisableForgotPassword() {
|
||||||
|
const setting = Settings.findOne({});
|
||||||
|
if (!setting.disableForgotPassword) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
disableForgotPassword: `${setting.disableForgotPassword}`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
getMatomoConf() {
|
getMatomoConf() {
|
||||||
return {
|
return {
|
||||||
address: getEnvVar('MATOMO_ADDRESS'),
|
address: getEnvVar('MATOMO_ADDRESS'),
|
||||||
|
|
|
@ -10,6 +10,7 @@ Meteor.publish('setting', () => {
|
||||||
{
|
{
|
||||||
fields: {
|
fields: {
|
||||||
disableRegistration: 1,
|
disableRegistration: 1,
|
||||||
|
disableForgotPassword: 1,
|
||||||
productName: 1,
|
productName: 1,
|
||||||
hideLogo: 1,
|
hideLogo: 1,
|
||||||
customLoginLogoImageUrl: 1,
|
customLoginLogoImageUrl: 1,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue