Libera la versión de desarrollo 0.0.2
This commit is contained in:
parent
516d9683da
commit
fbc6ab2adf
77 changed files with 651 additions and 161 deletions
59
pagetop-user/src/lib.rs
Normal file
59
pagetop-user/src/lib.rs
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
localize!("src/locales");
|
||||
|
||||
mod entity;
|
||||
mod migration;
|
||||
|
||||
pub struct UserModule;
|
||||
|
||||
impl ModuleTrait for UserModule {
|
||||
fn fullname(&self) -> String {
|
||||
l("module_fullname")
|
||||
}
|
||||
|
||||
fn description(&self) -> Option<String> {
|
||||
Some(l("module_description"))
|
||||
}
|
||||
|
||||
fn configure_module(&self, cfg: &mut app::web::ServiceConfig) {
|
||||
cfg.route("/user/login", app::web::get().to(login));
|
||||
}
|
||||
|
||||
fn migrations(&self) -> Vec<Box<dyn db::migration::MigrationTrait>> {
|
||||
vec![
|
||||
boxed_migration!(m20220312_000001_create_table_user)
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
fn form_login() -> impl PageComponent {
|
||||
Form::prepare()
|
||||
.with_id("user-login")
|
||||
.add(form::Input::textfield()
|
||||
.with_name("name")
|
||||
.with_label(l("username").as_str())
|
||||
.with_help_text(t("username_help", &args![
|
||||
"app" => SETTINGS.app.name.to_owned()
|
||||
]).as_str())
|
||||
.autofocus(true)
|
||||
)
|
||||
.add(form::Input::password()
|
||||
.with_name("pass")
|
||||
.with_label(l("password").as_str())
|
||||
.with_help_text(l("password_help").as_str())
|
||||
)
|
||||
.add(form::Button::submit(l("login").as_str()))
|
||||
}
|
||||
|
||||
async fn login() -> app::Result<Markup> {
|
||||
Page::prepare()
|
||||
.with_title(
|
||||
"Identificación del usuario"
|
||||
)
|
||||
.add_to("content", Container::prepare()
|
||||
.with_id("welcome")
|
||||
.add(form_login())
|
||||
)
|
||||
.render()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue