mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-11-03 17:13:05 +00:00
Do the right thing when we have a username but no password
With a username parameter but no password parameter we'll attribute edits to that username, but not require authentication.
This commit is contained in:
@@ -19,7 +19,7 @@ exports.path = /^\/status$/;
|
||||
exports.handler = function(request,response,state) {
|
||||
response.writeHead(200, {"Content-Type": "application/json"});
|
||||
var text = JSON.stringify({
|
||||
username: state.authenticatedUsername,
|
||||
username: state.authenticatedUsername || state.server.get("username") || "",
|
||||
space: {
|
||||
recipe: "default"
|
||||
},
|
||||
|
||||
@@ -43,9 +43,10 @@ function Server(options) {
|
||||
}
|
||||
$tw.utils.extend({},this.defaultVariables,options.variables);
|
||||
// Initialise authorization
|
||||
var authorizedUserName = (this.get("username") && this.get("password")) ? this.get("username") : "(anon)";
|
||||
this.authorizationPrincipals = {
|
||||
readers: (this.get("readers") || this.get("username") || "(anon)").split(",").map($tw.utils.trim),
|
||||
writers: (this.get("writers") || this.get("username") || "(anon)").split(",").map($tw.utils.trim)
|
||||
readers: (this.get("readers") || authorizedUserName).split(",").map($tw.utils.trim),
|
||||
writers: (this.get("writers") || authorizedUserName).split(",").map($tw.utils.trim)
|
||||
}
|
||||
// Load and initialise authenticators
|
||||
$tw.modules.forEachModuleOfType("authenticator", function(title,authenticatorDefinition) {
|
||||
|
||||
Reference in New Issue
Block a user