Hastic standalone
https://hastic.io
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
512 B
26 lines
512 B
3 years ago
|
use serde::{ Deserialize, Serialize };
|
||
|
|
||
3 years ago
|
|
||
|
pub type AccessToken = String;
|
||
|
|
||
3 years ago
|
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||
|
pub struct User {
|
||
|
pub username: String,
|
||
|
pub password: String
|
||
|
}
|
||
|
|
||
|
pub struct UserService {
|
||
|
|
||
|
}
|
||
|
|
||
|
impl UserService {
|
||
|
pub fn new() -> UserService {
|
||
|
UserService{}
|
||
|
}
|
||
3 years ago
|
pub fn login(user: &User) -> Option<AccessToken> {
|
||
|
if user.username == "admin" && user.password == "admin" {
|
||
|
return Some("asdsadsad".to_string());
|
||
|
}
|
||
|
return None;
|
||
|
}
|
||
3 years ago
|
}
|