Accounts: Remove traces of ructe, toolkit
This commit is contained in:
parent
124f8ac4c7
commit
0bacafd8a8
|
@ -12,7 +12,6 @@ actix-web = "3.3.2"
|
|||
bcrypt = "0.9.0"
|
||||
event-listener = "2.5.1"
|
||||
futures = "0.3.8"
|
||||
hyaenidae-toolkit = { version = "0.1.0", path = "../toolkit" }
|
||||
log = "0.4.11"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
|
|
@ -9,7 +9,6 @@ pub type CookiesArgs = (Session, web::Data<State>);
|
|||
#[derive(Debug)]
|
||||
pub struct CookiesState {
|
||||
state: State,
|
||||
pub dark: bool,
|
||||
}
|
||||
|
||||
pub fn cookies_page((cookies, state): CookiesPageArgs) -> Result<CookiesState, HttpResponse> {
|
||||
|
@ -30,14 +29,9 @@ impl CookiesState {
|
|||
fn new(state: &State) -> Self {
|
||||
CookiesState {
|
||||
state: state.clone(),
|
||||
dark: false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn dark(&mut self, dark: bool) {
|
||||
self.dark = dark;
|
||||
}
|
||||
|
||||
pub fn cookies_path(&self) -> String {
|
||||
self.state.pages.cookies_path()
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ pub struct DeleteUserState {
|
|||
state: State,
|
||||
form: Option<DeleteUserForm>,
|
||||
error: Option<DeleteUserError>,
|
||||
pub dark: bool,
|
||||
}
|
||||
|
||||
pub fn delete_user_page((_, state): DeleteUserPageArgs) -> Result<DeleteUserState, HttpResponse> {
|
||||
|
@ -45,7 +44,6 @@ impl DeleteUserState {
|
|||
state: state.clone(),
|
||||
form: None,
|
||||
error: None,
|
||||
dark: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,14 +52,9 @@ impl DeleteUserState {
|
|||
state: state.clone(),
|
||||
form: form.into(),
|
||||
error: error.into(),
|
||||
dark: false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn dark(&mut self, dark: bool) {
|
||||
self.dark = dark;
|
||||
}
|
||||
|
||||
pub fn delete_user_path(&self) -> String {
|
||||
self.state.pages.delete_user_path()
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ pub struct LoginState {
|
|||
state: State,
|
||||
form: Option<LoginForm>,
|
||||
error: Option<LoginError>,
|
||||
pub dark: bool,
|
||||
}
|
||||
|
||||
pub fn login_page(
|
||||
|
@ -64,16 +63,11 @@ pub async fn login(
|
|||
}
|
||||
|
||||
impl LoginState {
|
||||
pub fn dark(&mut self, dark: bool) {
|
||||
self.dark = dark;
|
||||
}
|
||||
|
||||
fn new_empty(state: &State) -> Self {
|
||||
LoginState {
|
||||
state: state.clone(),
|
||||
form: None,
|
||||
error: None,
|
||||
dark: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +76,6 @@ impl LoginState {
|
|||
state: state.clone(),
|
||||
form: Some(form),
|
||||
error: Some(error),
|
||||
dark: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,10 +36,6 @@ impl LogoutState {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn button<'a>(&self, btn: hyaenidae_toolkit::Button) -> hyaenidae_toolkit::Button {
|
||||
btn.form(&self.logout_path())
|
||||
}
|
||||
|
||||
pub fn logout_path(&self) -> String {
|
||||
self.state.pages.logout_path()
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ pub struct RegisterState {
|
|||
state: State,
|
||||
form: Option<RegisterForm>,
|
||||
error: Option<RegisterError>,
|
||||
pub dark: bool,
|
||||
}
|
||||
|
||||
pub fn register_page(
|
||||
|
@ -70,7 +69,6 @@ impl RegisterState {
|
|||
state: state.clone(),
|
||||
form: None,
|
||||
error: None,
|
||||
dark: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,14 +77,9 @@ impl RegisterState {
|
|||
state: state.clone(),
|
||||
form: Some(form),
|
||||
error: Some(error),
|
||||
dark: false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn dark(&mut self, dark: bool) {
|
||||
self.dark = dark;
|
||||
}
|
||||
|
||||
pub fn register_path(&self) -> String {
|
||||
self.state.pages.register_path()
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ pub struct UpdatePasswordState {
|
|||
state: State,
|
||||
form: Option<UpdatePasswordForm>,
|
||||
error: Option<UpdatePasswordError>,
|
||||
pub dark: bool,
|
||||
}
|
||||
|
||||
pub fn update_password_page((_, state): UpdatePasswordPageArgs) -> UpdatePasswordState {
|
||||
|
@ -45,7 +44,6 @@ impl UpdatePasswordState {
|
|||
state: state.clone(),
|
||||
form: None,
|
||||
error: None,
|
||||
dark: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,14 +56,9 @@ impl UpdatePasswordState {
|
|||
state: state.clone(),
|
||||
form: Some(form),
|
||||
error: Some(error),
|
||||
dark: false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn dark(&mut self, dark: bool) {
|
||||
self.dark = dark;
|
||||
}
|
||||
|
||||
pub fn update_password_path(&self) -> String {
|
||||
self.state.pages.update_password_path()
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ pub struct UpdateUsernameState {
|
|||
state: State,
|
||||
form: Option<UpdateUsernameForm>,
|
||||
error: Option<UpdateUsernameError>,
|
||||
pub dark: bool,
|
||||
}
|
||||
|
||||
pub fn update_username_page((_, state): UpdateUsernamePageArgs) -> UpdateUsernameState {
|
||||
|
@ -44,7 +43,6 @@ impl UpdateUsernameState {
|
|||
state: state.clone(),
|
||||
form: None,
|
||||
error: None,
|
||||
dark: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,14 +55,9 @@ impl UpdateUsernameState {
|
|||
state: state.clone(),
|
||||
form: Some(form),
|
||||
error: Some(error),
|
||||
dark: false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn dark(&mut self, dark: bool) {
|
||||
self.dark = dark;
|
||||
}
|
||||
|
||||
pub fn update_username_path(&self) -> String {
|
||||
self.state.pages.update_username_path()
|
||||
}
|
||||
|
|
|
@ -56,7 +56,6 @@ pub trait Pages {
|
|||
|
||||
#[derive(Clone)]
|
||||
pub struct Config {
|
||||
pub toolkit_path: String,
|
||||
pub key: Vec<u8>,
|
||||
pub https: bool,
|
||||
pub pages: Arc<dyn Pages + Send + Sync>,
|
||||
|
@ -64,7 +63,6 @@ pub struct Config {
|
|||
|
||||
#[derive(Clone)]
|
||||
pub struct State {
|
||||
toolkit_path: String,
|
||||
user_store: store::UserStore,
|
||||
db: Db,
|
||||
pages: Arc<dyn Pages + Send + Sync>,
|
||||
|
@ -82,7 +80,6 @@ impl State {
|
|||
|
||||
pub fn state(config: &Config, db: Db) -> Result<State, store::StoreError> {
|
||||
Ok(State {
|
||||
toolkit_path: config.toolkit_path.clone(),
|
||||
user_store: store::UserStore::build(&db)?,
|
||||
db,
|
||||
pages: Arc::clone(&config.pages),
|
||||
|
@ -110,7 +107,6 @@ pub enum Error {
|
|||
impl std::fmt::Debug for Config {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
f.debug_struct("Config")
|
||||
.field("toolkit_path", &self.toolkit_path)
|
||||
.field("key", &"Key")
|
||||
.field("https", &self.https)
|
||||
.field("pages", &"Box<dyn Pages>")
|
||||
|
@ -121,7 +117,6 @@ impl std::fmt::Debug for Config {
|
|||
impl std::fmt::Debug for State {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
f.debug_struct("State")
|
||||
.field("toolkit_path", &self.toolkit_path)
|
||||
.field("user_store", &"UserStore")
|
||||
.field("db", &"Db")
|
||||
.finish()
|
||||
|
|
Loading…
Reference in a new issue