diff options
author | Simo Sorce <idra@samba.org> | 2005-06-03 14:17:18 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:17:30 -0500 |
commit | 266c37e5dc97879e30e790cd87d2ec1f43907477 (patch) | |
tree | 8748f0a03380193c91e9bc2151b5ce97da7f8269 /swat | |
parent | 98a18d670475aedccbce28f43c1dd01da8cb517e (diff) | |
download | samba-266c37e5dc97879e30e790cd87d2ec1f43907477.tar.gz samba-266c37e5dc97879e30e790cd87d2ec1f43907477.tar.xz samba-266c37e5dc97879e30e790cd87d2ec1f43907477.zip |
r7238: Add pam auth support in swat
(This used to be commit 8a98572a3b5dba58181dc402dbebae5452656012)
Diffstat (limited to 'swat')
-rw-r--r-- | swat/login.esp | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/swat/login.esp b/swat/login.esp index 873ff2f6a6b..f118eab1a2f 100644 --- a/swat/login.esp +++ b/swat/login.esp @@ -6,12 +6,15 @@ if (request['SESSION_EXPIRED'] == "True") { write("<b>Your session has expired - please authenticate again<br /></b>\n"); } -var f = FormObj("login", 2, 1); +var f = FormObj("login", 3, 1); f.element[0].label = "Username"; f.element[0].value = form['Username']; f.element[1].label = "Password"; f.element[1].value = form['Password']; f.element[1].type = "password"; +f.element[2].label = "Domain"; +f.element[2].type = "select"; +f.element[2].list = getDomainList(); f.submit[0] = "Login"; display_form(f); @@ -19,20 +22,28 @@ display_form(f); <% if (request.REQUEST_METHOD == "POST") { - /* for now just authenticate everyone */ - session.AUTHENTICATED = true; - session.authinfo = new Object(); - - session.authinfo.username = form.Username; - - /* if the user was asking for the login page, then now - redirect them to the main page. Otherwise just - redirect them to the current page, which will now - show its true content */ - if (request.REQUEST_URI == "/login.esp") { - redirect(session_uri("/")); + + auth = userAuth(form.Username, form.Password, form.Domain); + if (auth.result) { + + /* for now just authenticate everyone */ + session.AUTHENTICATED = true; + session.authinfo = new Object(); + + session.authinfo.username = auth.username; + session.authinfo.domain = auth.domain; + + /* if the user was asking for the login page, then now + redirect them to the main page. Otherwise just + redirect them to the current page, which will now + show its true content */ + if (request.REQUEST_URI == "/login.esp") { + redirect(session_uri("/")); + } else { + redirect(session_uri(request.REQUEST_URI)); + } } else { - redirect(session_uri(request.REQUEST_URI)); + write("<b>Login failed - please try again<br /></b>\n"); } } %> |