mirror of
https://github.com/wekan/wekan.git
synced 2025-04-20 12:07:11 -04: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) => {
|
||||
if (result) {
|
||||
$('.at-signUp').hide();
|
||||
$('.at-signup-link').hide();
|
||||
}
|
||||
});
|
||||
|
||||
Meteor.call('isDisableForgotPassword', (_, data) => {
|
||||
Meteor.call('isDisableForgotPassword', (_, result) => {
|
||||
if (result) {
|
||||
$('.at-forgotPwd').hide();
|
||||
$('.at-pwd-link').hide();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Template.userFormsLayout.onRendered(() => {
|
||||
|
|
|
@ -2,18 +2,29 @@ const passwordField = AccountsTemplates.removeField('password');
|
|||
const emailField = AccountsTemplates.removeField('email');
|
||||
let disableRegistration = false;
|
||||
let disableForgotPassword = false;
|
||||
let passwordLoginDisabled = false;
|
||||
|
||||
Meteor.call('isDisableRegistration', (err, data) => {
|
||||
if (!err) {
|
||||
disableRegistration = data;
|
||||
console.log(data);
|
||||
Meteor.call('isPasswordLoginDisabled', (_, result) => {
|
||||
if (result) {
|
||||
passwordLoginDisabled = true;
|
||||
//console.log('passwordLoginDisabled');
|
||||
//console.log(result);
|
||||
}
|
||||
});
|
||||
|
||||
Meteor.call('isDisableForgotPassword', (err, data) => {
|
||||
if (!err) {
|
||||
disableForgotPassword = data;
|
||||
console.log(data);
|
||||
Meteor.call('isDisableRegistration', (_, result) => {
|
||||
if (result) {
|
||||
disableRegistration = true;
|
||||
//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,
|
||||
enablePasswordChange: true,
|
||||
sendVerificationEmail: true,
|
||||
showForgotPasswordLink: disableForgotPassword === false,
|
||||
forbidClientAccountCreation: disableRegistration === true,
|
||||
showForgotPasswordLink: !disableForgotPassword,
|
||||
forbidClientAccountCreation: disableRegistration,
|
||||
onLogoutHook() {
|
||||
const homePage = 'home';
|
||||
if (FlowRouter.getRouteName() === homePage) {
|
||||
|
@ -55,14 +66,14 @@ AccountsTemplates.configure({
|
|||
},
|
||||
});
|
||||
|
||||
if (disableForgotPassword === false) {
|
||||
if (!disableForgotPassword) {
|
||||
[
|
||||
'forgotPwd',
|
||||
'resetPwd',
|
||||
].forEach(routeName => AccountsTemplates.configureRoute(routeName));
|
||||
}
|
||||
|
||||
if (disableRegistration === false) {
|
||||
if (!disableRegistration) {
|
||||
[
|
||||
'signUp',
|
||||
].forEach(routeName => AccountsTemplates.configureRoute(routeName));
|
||||
|
|
|
@ -444,7 +444,7 @@ if (Meteor.isServer) {
|
|||
|
||||
isDisableRegistration() {
|
||||
const setting = Settings.findOne({});
|
||||
if (setting.disableRegistration === 'true') {
|
||||
if (setting.disableRegistration === true) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -453,7 +453,7 @@ if (Meteor.isServer) {
|
|||
|
||||
isDisableForgotPassword() {
|
||||
const setting = Settings.findOne({});
|
||||
if (setting.disableForgotPassword === 'true') {
|
||||
if (setting.disableForgotPassword === true) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue