1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 09:00:10 +00:00

fix table sizing on bootstrap 4; fix profile application on single-use

invites

use table-sm and no form-check-input so profile menu looks normal on
bs4. Profile was being read after being marked as used on invites, so
single-use invites were deleted and no profile was applied.
This commit is contained in:
Harvey Tindall 2020-09-23 19:12:58 +01:00
parent 89e70f6f7a
commit 9bd7fca95e
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
5 changed files with 11 additions and 9 deletions

4
api.go
View File

@ -271,8 +271,9 @@ func (app *appContext) NewUser(gc *gin.Context) {
respond(401, "Unknown error", gc)
return
}
app.checkInvite(req.Code, true, req.Username)
app.storage.loadProfiles()
invite := app.storage.invites[req.Code]
app.checkInvite(req.Code, true, req.Username)
if app.config.Section("notifications").Key("enabled").MustBool(false) {
for address, settings := range invite.Notify {
if settings["notify-creation"] {
@ -296,6 +297,7 @@ func (app *appContext) NewUser(gc *gin.Context) {
id = user["Id"].(string)
}
if invite.Profile != "" {
app.debug.Printf("Applying settings from profile \"%s\"", invite.Profile)
profile, ok := app.storage.profiles[invite.Profile]
if !ok {
profile = app.storage.profiles["Default"]

View File

@ -177,7 +177,7 @@
"bs5": {
"name": "Use Bootstrap 5",
"required": false,
"requires_restart": false,
"requires_restart": true,
"type": "bool",
"value": false,
"description": "Use Bootstrap 5 (currently in alpha). This also removes the need for jQuery, so the page should load faster."

View File

@ -216,7 +216,7 @@
"bs5": {
"name": "Use Bootstrap 5",
"required": false,
"requires_restart": false,
"requires_restart": true,
"type": "bool",
"value": false,
"description": "Use Bootstrap 5 (currently in alpha). This also removes the need for jQuery, so the page should load faster."
@ -715,7 +715,7 @@
"requires_restart": true,
"type": "text",
"value": "",
"description": "Location of stored user policy template (json)."
"description": "Deprecated. Location of stored user policy template (json)."
},
"user_configuration": {
"name": "userConfiguration",
@ -723,7 +723,7 @@
"requires_restart": true,
"type": "text",
"value": "",
"description": "Location of stored user configuration template (used for setting homescreen layout) (json)"
"description": "Deprecated. Location of stored user configuration template (used for setting homescreen layout) (json)"
},
"user_displayprefs": {
"name": "displayPreferences",
@ -731,7 +731,7 @@
"requires_restart": true,
"type": "text",
"value": "",
"description": "Location of stored displayPreferences template (also used for homescreen layout) (json)"
"description": "Deprecated. Location of stored displayPreferences template (also used for homescreen layout) (json)"
},
"user_profiles": {
"name": "User Profiles",
@ -739,7 +739,7 @@
"requires_restart": true,
"type": "text",
"value": "",
"description": "Location of stored user profiles (encompasses template and homescreen) (json)"
"description": "Location of stored user profiles (encompasses template and configuration and displayprefs) (json)"
},
"custom_css": {
"name": "Custom CSS",

View File

@ -437,7 +437,7 @@
<div id="profiles" class="unfocused">
<div class="card card-body">
<p>Profiles are applied to users when they create an account. They include things like access rights and homescreen layout. You can create them here.</p>
<table class="table table-striped table-borderless">
<table class="table table-sm table-striped table-borderless">
<thead>
<tr>
<th scope="col">Name</th>

View File

@ -156,7 +156,7 @@ const populateProfiles = (noTable?: boolean): void => _get("/getProfiles", null,
};
profileList.innerHTML += `
<td nowrap="nowrap" class="align-middle"><strong>${name}</strong></td>
<td nowrap="nowrap" class="align-middle"><input class="form-check-input" type="radio" name="defaultProfile" onclick="setDefaultProfile('${name}')" ${(name == availableProfiles[0]) ? "checked" : ""}></td>
<td nowrap="nowrap" class="align-middle"><input class="${(bsVersion == 5) ? "form-check-input" : ""}" type="radio" name="defaultProfile" onclick="setDefaultProfile('${name}')" ${(name == availableProfiles[0]) ? "checked" : ""}></td>
<td nowrap="nowrap" class="align-middle">${profile.FromUser}</td>
<td nowrap="nowrap" class="align-middle">${profile.Admin ? "Yes" : "No"}</td>
<td nowrap="nowrap" class="align-middle">${profile.LibraryAccess}</td>