feat: signups can now be enabled/disabled from portal settings

This commit is contained in:
Jannat Patel
2025-04-07 18:15:30 +05:30
parent c70da08078
commit 5bc44e6fe5
6 changed files with 35 additions and 15 deletions

View File

@@ -146,7 +146,6 @@ function resetEditor(value: string, resetHistory = false) {
value = getModelValue() value = getModelValue()
aceEditor?.setValue(value) aceEditor?.setValue(value)
aceEditor?.clearSelection() aceEditor?.clearSelection()
console.log(isDark.value)
aceEditor?.setTheme(isDark.value ? 'ace/theme/twilight' : 'ace/theme/chrome') aceEditor?.setTheme(isDark.value ? 'ace/theme/twilight' : 'ace/theme/chrome')
props.autofocus && aceEditor?.focus() props.autofocus && aceEditor?.focus()
if (resetHistory) { if (resetHistory) {

View File

@@ -328,19 +328,26 @@ const tabsStructure = computed(() => {
icon: 'LogIn', icon: 'LogIn',
fields: [ fields: [
{ {
label: 'Custom Content', label: 'Identify User Persona',
name: 'user_category',
type: 'checkbox',
description:
'Enable this option to identify the user persona during signup.',
},
{
label: 'Disable signup',
name: 'disable_signup',
type: 'checkbox',
description:
'New users will have to be manually registered by Admins.',
},
{
label: 'Signup Consent HTML',
name: 'custom_signup_content', name: 'custom_signup_content',
type: 'Code', type: 'Code',
mode: 'htmlmixed', mode: 'htmlmixed',
rows: 10, rows: 10,
}, },
{
label: 'Ask for Occupation',
name: 'user_category',
type: 'checkbox',
description:
'Enable this option to ask users to select their occupation during the signup process.',
},
], ],
}, },
], ],

View File

@@ -99,7 +99,7 @@
</template> </template>
<script setup> <script setup>
import { FormControl, FileUploader, Button, Switch } from 'frappe-ui' import { FormControl, FileUploader, Button, Switch } from 'frappe-ui'
import { computed } from 'vue' import { computed, onMounted } from 'vue'
import { getFileSize, validateFile } from '@/utils' import { getFileSize, validateFile } from '@/utils'
import { X } from 'lucide-vue-next' import { X } from 'lucide-vue-next'
import Link from '@/components/Controls/Link.vue' import Link from '@/components/Controls/Link.vue'

View File

@@ -27,8 +27,9 @@
"signup_settings_tab", "signup_settings_tab",
"signup_settings_section", "signup_settings_section",
"column_break_9", "column_break_9",
"custom_signup_content",
"user_category", "user_category",
"disable_signup",
"custom_signup_content",
"sidebar_tab", "sidebar_tab",
"items_in_sidebar_section", "items_in_sidebar_section",
"courses", "courses",
@@ -104,7 +105,7 @@
"default": "0", "default": "0",
"fieldname": "user_category", "fieldname": "user_category",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Ask User Category during Signup" "label": "Identify User Persona"
}, },
{ {
"default": "0", "default": "0",
@@ -365,12 +366,19 @@
"fieldtype": "Link", "fieldtype": "Link",
"label": "Payment Reminder Template", "label": "Payment Reminder Template",
"options": "Email Template" "options": "Email Template"
},
{
"default": "0",
"fieldname": "disable_signup",
"fieldtype": "Check",
"label": "Disable Signup"
} }
], ],
"grid_page_length": 50,
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"issingle": 1, "issingle": 1,
"links": [], "links": [],
"modified": "2025-02-11 11:29:43.412897", "modified": "2025-04-07 18:05:52.000651",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "LMS", "module": "LMS",
"name": "LMS Settings", "name": "LMS Settings",
@@ -394,8 +402,9 @@
"share": 1 "share": 1
} }
], ],
"row_format": "Dynamic",
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"states": [], "states": [],
"track_changes": 1 "track_changes": 1
} }

View File

@@ -10,6 +10,7 @@ from frappe.utils import get_url_to_list
class LMSSettings(Document): class LMSSettings(Document):
def validate(self): def validate(self):
self.validate_google_settings() self.validate_google_settings()
self.validate_signup()
def validate_google_settings(self): def validate_google_settings(self):
if self.send_calendar_invite_for_evaluations: if self.send_calendar_invite_for_evaluations:
@@ -40,6 +41,10 @@ class LMSSettings(Document):
) )
) )
def validate_signup(self):
if self.has_value_changed("disable_signup"):
frappe.db.set_single_value("Website Settings", "disable_signup", self.disable_signup)
@frappe.whitelist() @frappe.whitelist()
def check_payments_app(): def check_payments_app():

View File

@@ -17,7 +17,7 @@
<label class="form-label sr-only"> {{ _("User Category") }} </label> <label class="form-label sr-only"> {{ _("User Category") }} </label>
<div class="control-input-wrapper"> <div class="control-input-wrapper">
<div class="control-input flex align-center"> <div class="control-input flex align-center">
<select type="text" id="user_category" data-fieldname="user_category" style="color: var(--text-muted)" <select type="text" id="user_category" data-fieldname="user_category" style="color: var(--text-light)"
class="input-with-feedback form-control ellipsis" data-fieldtype="Select" required> class="input-with-feedback form-control ellipsis" data-fieldtype="Select" required>
<option value=""> {{ _("Category") }} </option> <option value=""> {{ _("Category") }} </option>
<option value="Business Owner"> {{ _("Business Owner") }} </option> <option value="Business Owner"> {{ _("Business Owner") }} </option>