Browse code

test passing variables using GET, refine login page css

Dario Rodriguez authored on 23/06/2014 21:31:49
Showing 3 changed files
... ...
@@ -6,8 +6,8 @@
6 6
 <body>
7 7
  <div class="centered">
8 8
    <p class='title'>Acceso restringido</p>
9
-   <p><span class='label'>Usuario</span> <input class='rounded' id='user' type ='input' value=''/></p>
10
-   <p><span class='label'>Clave</span> <input class='rounded' id='pass' type ='password' value=''/></p>
9
+   <p class="aligned"><span class='label'>Usuario</span> <input class='almostrounded' id='user' type ='input' value=''/></p>
10
+   <p class="aligned"><span class='label'>Clave</span> <input class='almostrounded' id='pass' type ='password' value=''/></p>
11 11
    <span class='centeredbutton'><input class='rounded' id='dologin' type ='button' value='Acceder'/></span>
12 12
  </div>
13 13
  <script src='script.js'></script>
... ...
@@ -20,15 +20,47 @@ input.rounded {
20 20
 input.rounded:focus {
21 21
 	border-color: #339933;
22 22
 }
23
+
24
+input.almostrounded {
25
+	border: 1px solid #ccc;
26
+	-moz-border-radius: 2px;
27
+	-webkit-border-radius: 2px;
28
+	border-radius: 2px;
29
+	-moz-box-shadow: 0px 0px 3px #666;
30
+	-webkit-box-shadow: 0px 0px 3px #666;
31
+	box-shadow: 0px 0px 3px #666;
32
+	font-size: 20px;
33
+	padding: 4px 7px;
34
+	outline: 0;
35
+	-webkit-appearance: none;
36
+}
37
+
38
+input.almostrounded:focus {
39
+	border-color: #339933;
40
+}
41
+
23 42
 div.centered {
24
-	background-color: #cede91;
43
+/* gradient */
44
+background-image: -webkit-gradient(
45
+        linear,
46
+        left bottom,
47
+        left bottom,
48
+        color-stop(0.11, #C7C7C7),
49
+        color-stop(0.81, #EEEEEE)
50
+);
51
+background-image: -o-linear-gradient(left bottom, #C7C7C7 11%, #EEEEEE 81%);
52
+background-image: -moz-linear-gradient(left bottom, #C7C7C7 11%, #EEEEEE 81%);
53
+background-image: -webkit-linear-gradient(left bottom, #C7C7C7 11%, #EEEEEE 81%);
54
+background-image: -ms-linear-gradient(left bottom, #C7C7C7 11%, #EEEEEE 81%);
55
+background-image: linear-gradient(to left bottom, #C7C7C7 11%, #EEEEEE 81%);
56
+/* border */
25 57
 	border: 1px solid #ccc;
26
-	-moz-border-radius: 20px;
27
-	-webkit-border-radius: 20px;
28
-	border-radius: 20px;
29
-	-moz-box-shadow: 2px 2px 3px #666;
30
-	-webkit-box-shadow: 2px 2px 3px #666;
31
-	box-shadow: 2px 2px 3px #666;
58
+	-moz-border-radius: 2px;
59
+	-webkit-border-radius: 2px;
60
+	border-radius: 2px;
61
+	-moz-box-shadow: 0px 0px 3px #666;
62
+	-webkit-box-shadow: 0px 0px 3px #666;
63
+	box-shadow: 0px 0px 3px #666;
32 64
 	font-size: 20px;
33 65
 	padding: 16px 24px;
34 66
 	outline: 0;
... ...
@@ -47,3 +79,13 @@ p.title {
47 79
 	padding: 0px 0px 20px 0px;
48 80
 }
49 81
 
82
+.aligned {
83
+	list-style-type: none;
84
+	padding-left: 30px;
85
+}
86
+
87
+.aligned .label {
88
+	float: left;
89
+	width: 50px;
90
+	padding: 4px 10px 0px 0px;
91
+}
... ...
@@ -45,7 +45,7 @@ main(int argc, char *argv[])
45 45
                 fprintf(stderr,"ERROR: insufficient memory\n");
46 46
                 return(1);
47 47
         }
48
-        if((ka->web=wk_init(port,ka->ssel,NULL,callback_http,NULL,ka))==NULL) {
48
+        if((ka->web=wk_init(port,ka->ssel,NULL,callback_http,NULL,NULL,ka))==NULL) {
49 49
                 sselect_free(ka->ssel),ka->ssel=NULL;
50 50
                 fprintf(stderr,"ERROR: couldn't init web server\n");
51 51
                 return(2);
... ...
@@ -74,7 +74,14 @@ callback_http(wk *web, int connid, wk_uri *uri, void *userptr)
74 74
                 return(wkact_finished);
75 75
         }
76 76
         if(memcmp(uri->path,"/doLogin?",9)==0) {
77
-                printf("Login: %s\n",uri->path+9);
77
+                char u[128],p[128];
78
+                if(wk_uri_copyvar(uri,"u",u,sizeof(u))==NULL)
79
+                        u[0]='\0';
80
+                if(wk_uri_copyvar(uri,"p",p,sizeof(p))==NULL)
81
+                        p[0]='\0';
82
+                printf("URI: %s\n",uri->path);
83
+                printf("Login: \"%s\"\n",u);
84
+                printf("Pass.: \"%s\"\n",p);
78 85
                 wk_serve_error(web,connid,wkerr_internal);
79 86
                 return(wkact_finished);
80 87
         }