changeset 753:5e3970ccd86a

improve password handling
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 15 Jul 2016 17:35:50 -0600
parents ea5f3a254b76
children 1a101ac9ea46
files core/src/luan/modules/Io.luan http/src/luan/modules/http/Server.luan lucene/src/luan/modules/lucene/Lucene.luan scripts/test.luan
diffstat 4 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/core/src/luan/modules/Io.luan	Fri Jul 15 16:18:22 2016 -0600
+++ b/core/src/luan/modules/Io.luan	Fri Jul 15 17:35:50 2016 -0600
@@ -13,6 +13,8 @@
 M.stdout = IoLuan.textWriter(System.out)
 M.stderr = IoLuan.textWriter(System.err)
 
+-- used by http and rpc
+M.password = "password"
 
 local Luan = require "luan:Luan.luan"
 local error = Luan.error
--- a/http/src/luan/modules/http/Server.luan	Fri Jul 15 16:18:22 2016 -0600
+++ b/http/src/luan/modules/http/Server.luan	Fri Jul 15 17:35:50 2016 -0600
@@ -33,8 +33,6 @@
 
 M.port = 8080
 
-M.private_password = "password"
-
 M.welcome_file = "index.html"
 
 
@@ -86,7 +84,7 @@
 	function Io.schemes.site(path)
 		return Io.uri( dir..path )
 	end
-	M.authentication_handler.setPassword(M.private_password)
+	M.authentication_handler.setPassword(Io.password)
 	local base = dir
 	if matches(base,"^classpath:") then
 		base = dir.."#"..M.welcome_file.."#"..M.welcome_file..".luan"
--- a/lucene/src/luan/modules/lucene/Lucene.luan	Fri Jul 15 16:18:22 2016 -0600
+++ b/lucene/src/luan/modules/lucene/Lucene.luan	Fri Jul 15 17:35:50 2016 -0600
@@ -9,7 +9,6 @@
 local String = require "luan:String.luan"
 local matches = String.matches or error()
 local Rpc = require "luan:Rpc.luan"
-local Hosting = require "luan:host/Hosting.luan"
 local LuceneIndex = require "java:luan.modules.lucene.LuceneIndex"
 local NumberFieldParser = require "java:luan.modules.lucene.queryparser.NumberFieldParser"
 local StringFieldParser = require "java:luan.modules.lucene.queryparser.StringFieldParser"
@@ -116,7 +115,7 @@
 
 	if Rpc.functions.backup == nil then
 		function Rpc.functions.lucene_backup(password)
-			if Hosting.password ~= nil and Hosting.password ~= password then
+			if Io.password ~= password then
 				error "wrong password"
 			end
 			local zip_file = uri("file:"..index.dir).parent().child("backup.zip")
--- a/scripts/test.luan	Fri Jul 15 16:18:22 2016 -0600
+++ b/scripts/test.luan	Fri Jul 15 17:35:50 2016 -0600
@@ -15,7 +15,6 @@
 local Lucene = require "luan:lucene/Lucene.luan"
 local Versioning = require "luan:lucene/Versioning.luan"
 local Mail = require "luan:mail/Mail.luan"
-local Stripe = require "luan:stripe/Stripe.luan"
 
 local error = Luan.error
 local range = Luan.range or error()