mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Try to fix Admin Panel / Disable Registration and Disable Forgot Password.
Thanks to urmel1960, Ben0it-T and xet7 ! Fixes #4384
This commit is contained in:
parent
454d0b270d
commit
0775e2a3e5
3 changed files with 29 additions and 17 deletions
|
|
@ -56,15 +56,16 @@ Template.userFormsLayout.onCreated(function() {
|
||||||
|
|
||||||
Meteor.call('isDisableRegistration', (_, result) => {
|
Meteor.call('isDisableRegistration', (_, result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
$('.at-signUp').hide();
|
$('.at-signup-link').hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Meteor.call('isDisableForgotPassword', (_, data) => {
|
Meteor.call('isDisableForgotPassword', (_, result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
$('.at-forgotPwd').hide();
|
$('.at-pwd-link').hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.userFormsLayout.onRendered(() => {
|
Template.userFormsLayout.onRendered(() => {
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,29 @@ const passwordField = AccountsTemplates.removeField('password');
|
||||||
const emailField = AccountsTemplates.removeField('email');
|
const emailField = AccountsTemplates.removeField('email');
|
||||||
let disableRegistration = false;
|
let disableRegistration = false;
|
||||||
let disableForgotPassword = false;
|
let disableForgotPassword = false;
|
||||||
|
let passwordLoginDisabled = false;
|
||||||
|
|
||||||
Meteor.call('isDisableRegistration', (err, data) => {
|
Meteor.call('isPasswordLoginDisabled', (_, result) => {
|
||||||
if (!err) {
|
if (result) {
|
||||||
disableRegistration = data;
|
passwordLoginDisabled = true;
|
||||||
console.log(data);
|
//console.log('passwordLoginDisabled');
|
||||||
|
//console.log(result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Meteor.call('isDisableForgotPassword', (err, data) => {
|
Meteor.call('isDisableRegistration', (_, result) => {
|
||||||
if (!err) {
|
if (result) {
|
||||||
disableForgotPassword = data;
|
disableRegistration = true;
|
||||||
console.log(data);
|
//console.log('disableRegistration');
|
||||||
|
//console.log(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Meteor.call('isDisableForgotPassword', (_, result) => {
|
||||||
|
if (result) {
|
||||||
|
disableForgotPassword = true;
|
||||||
|
//console.log('disableForgotPassword');
|
||||||
|
//console.log(result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -43,8 +54,8 @@ AccountsTemplates.configure({
|
||||||
confirmPassword: true,
|
confirmPassword: true,
|
||||||
enablePasswordChange: true,
|
enablePasswordChange: true,
|
||||||
sendVerificationEmail: true,
|
sendVerificationEmail: true,
|
||||||
showForgotPasswordLink: disableForgotPassword === false,
|
showForgotPasswordLink: !disableForgotPassword,
|
||||||
forbidClientAccountCreation: disableRegistration === true,
|
forbidClientAccountCreation: disableRegistration,
|
||||||
onLogoutHook() {
|
onLogoutHook() {
|
||||||
const homePage = 'home';
|
const homePage = 'home';
|
||||||
if (FlowRouter.getRouteName() === homePage) {
|
if (FlowRouter.getRouteName() === homePage) {
|
||||||
|
|
@ -55,14 +66,14 @@ AccountsTemplates.configure({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (disableForgotPassword === false) {
|
if (!disableForgotPassword) {
|
||||||
[
|
[
|
||||||
'forgotPwd',
|
'forgotPwd',
|
||||||
'resetPwd',
|
'resetPwd',
|
||||||
].forEach(routeName => AccountsTemplates.configureRoute(routeName));
|
].forEach(routeName => AccountsTemplates.configureRoute(routeName));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disableRegistration === false) {
|
if (!disableRegistration) {
|
||||||
[
|
[
|
||||||
'signUp',
|
'signUp',
|
||||||
].forEach(routeName => AccountsTemplates.configureRoute(routeName));
|
].forEach(routeName => AccountsTemplates.configureRoute(routeName));
|
||||||
|
|
|
||||||
|
|
@ -444,7 +444,7 @@ if (Meteor.isServer) {
|
||||||
|
|
||||||
isDisableRegistration() {
|
isDisableRegistration() {
|
||||||
const setting = Settings.findOne({});
|
const setting = Settings.findOne({});
|
||||||
if (setting.disableRegistration === 'true') {
|
if (setting.disableRegistration === true) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -453,7 +453,7 @@ if (Meteor.isServer) {
|
||||||
|
|
||||||
isDisableForgotPassword() {
|
isDisableForgotPassword() {
|
||||||
const setting = Settings.findOne({});
|
const setting = Settings.findOne({});
|
||||||
if (setting.disableForgotPassword === 'true') {
|
if (setting.disableForgotPassword === true) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue