X-Git-Url: http://git.samba.org/samba.git/?p=sfrench%2Fsamba-autobuild%2F.git;a=blobdiff_plain;f=swat%2Flogin.esp;h=10a0ba80d641a54fedcaa60c3f399cb624334999;hp=be5457fedd2c94d4b1a356165a7cad008b1de9b8;hb=632b7ec0d070c0c770587dab200cc9413833bf03;hpb=e39bdcf930f328592c4ef179ab21e2e789757d8e
diff --git a/swat/login.esp b/swat/login.esp
index be5457fedd2..10a0ba80d64 100644
--- a/swat/login.esp
+++ b/swat/login.esp
@@ -1,10 +1,20 @@
<% page_header("plain", "SWAT Login"); %>
<%
-var f = Form("login", 2, 1);
+
+if (request['SESSION_EXPIRED'] == "True") {
+ write("Your session has expired - please authenticate again
\n");
+}
+
+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);
@@ -12,20 +22,34 @@ 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("/");
+
+ var authinfo = new Object();
+ authinfo.username = form.Username;
+ authinfo.password = form.Password;
+ authinfo.domain = form.Domain;
+ authinfo.rhost = request['REMOTE_HOST'];
+
+ auth = userAuth(authinfo);
+ 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(request.REQUEST_URI);
+ write("Login failed - please try again
\n");
}
}
%>