summaryrefslogtreecommitdiff
path: root/src/server.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/server.rs')
-rw-r--r--src/server.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/server.rs b/src/server.rs
index dad728e..9e63cb3 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -14,25 +14,24 @@ use render;
use staticfile::Static;
use regex::Regex;
-struct Aaa(String);
+struct Login {
+ user: String,
+}
-impl iron_sessionstorage::Value for Aaa {
+impl iron_sessionstorage::Value for Login {
fn get_key() -> &'static str {
- "aaa"
+ "login"
}
fn into_raw(self) -> String {
- self.0
+ self.user
}
fn from_raw(v: String) -> Option<Self> {
- Some(Aaa(v))
+ Some(Login{ user: v })
}
}
fn overview(r: &mut Request) -> IronResult<Response> {
- let mut _value = match try!(r.session().get::<Aaa>()) {
- Some(aaa) => aaa,
- None => Aaa("".to_owned()),
- };
+ let mut _value = try!(r.session().get::<Login>());
let name = r.extensions
.get::<Router>()