From b0dd6a2b2ab9b6d3969a362c6c75db32e87ce154 Mon Sep 17 00:00:00 2001 From: Kload Date: Sun, 30 Jun 2013 11:57:23 +0000 Subject: [PATCH] Add HTTP auth password prompt --- yunohost.tac | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/yunohost.tac b/yunohost.tac index b976618b..e671322c 100755 --- a/yunohost.tac +++ b/yunohost.tac @@ -36,12 +36,14 @@ def http_exec(request): # Simple HTTP auth else: authorized = request.getUser() == 'admin' - try: YunoHostLDAP(password=request.getPassword()) - except YunoHostError: authorized = False + if authorized: + try: YunoHostLDAP(password=request.getPassword()) + except YunoHostError: authorized = False if not authorized: request.setResponseCode(401, 'Unauthorized') request.setHeader('Access-Control-Allow-Origin', '*') + request.setHeader('www-authenticate', 'Basic realm="Restricted Area"') return 'Unauthorized' # Sanitize arguments