mirror of
https://github.com/Jermolene/TiddlyWiki5.git
synced 2026-04-21 04:41:06 -07: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:
parent
501d0a8edc
commit
bdb68fea6d
2 changed files with 4 additions and 3 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue