summaryrefslogtreecommitdiffstats
path: root/src/schema.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/schema.rs')
-rw-r--r--src/schema.rs41
1 files changed, 33 insertions, 8 deletions
diff --git a/src/schema.rs b/src/schema.rs
index 55e46c0..65150c1 100644
--- a/src/schema.rs
+++ b/src/schema.rs
@@ -132,22 +132,47 @@ pub struct User {
132#[derive(Serialize, Deserialize, Debug, PartialEq)] 132#[derive(Serialize, Deserialize, Debug, PartialEq)]
133pub struct MetuId { 133pub struct MetuId {
134 id: String, 134 id: String,
135 passwd: String,
135} 136}
136 137
137// TODO: this will arrive encrypted <13-04-21, yigit> // 138// TODO: this will arrive encrypted <13-04-21, yigit> //
138#[derive(Serialize, Deserialize, Debug, PartialEq)] 139#[derive(Serialize, Deserialize, Debug, PartialEq)]
139pub struct AuthRequest { 140pub struct AuthRequest {
140 pub student_id: String, 141 pub student_id: String,
142 pub passwd: String,
141 pub public_key: String, 143 pub public_key: String,
142} 144}
143 145
144lazy_static! { 146lazy_static! {
145 static ref OUR_STUDENTS: HashSet<&'static str> = { 147 static ref OUR_STUDENTS: HashSet<(&'static str, &'static str)> = {
146 [ 148 [
147 "e254275", "e223687", "e211024", "e209888", "e223725", "e209362", "e209898", "e230995", 149 ("e254275", "DtNX1qk4YF4saRH"),
148 "e223743", "e223747", "e223749", "e223751", "e188126", "e209913", "e203608", "e233013", 150 ("e223687", "cvFEs4XLjuGBD1v"),
149 "e216982", "e217185", "e223780", "e194931", "e223783", "e254550", "e217203", "e217477", 151 ("e211024", "voQAcxiKJmEXYRT"),
150 "e223786", "e231060", "e223795", 152 ("e209888", "O75dli6AQtz2tUi"),
153 ("e223725", "xXuTD3Y4tyrv2Jz"),
154 ("e209362", "N7wGm5XU5zVWOWu"),
155 ("e209898", "aKBFfB8fZMq8pVn"),
156 ("e230995", "TgcHGlqeFhQGx42"),
157 ("e223743", "YVWVSWuIHplJk9C"),
158 ("e223747", "8LAeHrsjnwXh59Q"),
159 ("e223749", "HMFeJqVOzwCPHbc"),
160 ("e223751", "NjMsxmtmy2VOwMW"),
161 ("e188126", "QibuPdV2gXfsVJW"),
162 ("e209913", "kMxJvl2vHSWCy4A"),
163 ("e203608", "mfkkR0MWurk6Rp1"),
164 ("e233013", "GCqHxdOaDj2pWXx"),
165 ("e216982", "2Z0xmgCStnj5qg5"),
166 ("e217185", "BcaZNlzlhPph7A3"),
167 ("e223780", "2KvVxKUQaA9H4sn"),
168 ("e194931", "hsC0Wb8PQ5vzwdQ"),
169 ("e223783", "ETUJA3kt1QYvJai"),
170 ("e254550", "rPRjX0A4NefvKWi"),
171 ("e217203", "lN3IWhGyCrGfkk5"),
172 ("e217477", "O9xlMaa7LanC82w"),
173 ("e223786", "UxI6czykJfp9T9N"),
174 ("e231060", "VJgziofQQPCoisH"),
175 ("e223795", "pmcTCKox99NFsqp"),
151 ] 176 ]
152 .iter() 177 .iter()
153 .cloned() 178 .cloned()
@@ -162,9 +187,9 @@ impl fmt::Display for MetuId {
162} 187}
163 188
164impl MetuId { 189impl MetuId {
165 pub fn new(id: String) -> Option<Self> { 190 pub fn new(id: String, pwd: String) -> Option<Self> {
166 if OUR_STUDENTS.contains(&*id) { 191 if OUR_STUDENTS.contains(&(&*id, &*pwd)) {
167 Some(MetuId { id: id }) 192 Some(MetuId { id: id, passwd: pwd })
168 } else { 193 } else {
169 None 194 None
170 } 195 }