summaryrefslogtreecommitdiff
path: root/src/server.rs
diff options
context:
space:
mode:
authorKjetil Orbekk <kjetil.orbekk@gmail.com>2017-06-17 16:22:05 -0400
committerKjetil Orbekk <kjetil.orbekk@gmail.com>2017-06-17 16:22:05 -0400
commit72844ca385bf7c503826cf6b684c8fa724973064 (patch)
treee539367acdd7f43539a4894e6df786e42712d85b /src/server.rs
parent1ef1e9c309a187aaee3e736aef621b272cc805d8 (diff)
ui: Add navigation bar (for login details).
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>()