feat: Implement user authentication with database integration and update routing.
This commit is contained in:
parent
9487107e90
commit
94593f54b1
1084
Cargo.lock
generated
1084
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
19
Cargo.toml
19
Cargo.toml
@ -7,12 +7,29 @@ edition = "2021"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
argon2 = { version = "0.5.3", features = ["std"], optional = true }
|
||||||
|
axum = { version = "0.8.7", optional = true }
|
||||||
dioxus = { version = "0.7.1", features = ["router", "fullstack"] }
|
dioxus = { version = "0.7.1", features = ["router", "fullstack"] }
|
||||||
tokio = { version = "1.48.0", features = ["full"], optional = true }
|
tokio = { version = "1.48.0", features = ["full"], optional = true }
|
||||||
|
sea-orm = { version = "1.1.4", features = [
|
||||||
|
"sqlx-sqlite",
|
||||||
|
"runtime-tokio-rustls",
|
||||||
|
"macros",
|
||||||
|
], optional = true }
|
||||||
|
dotenvy = { version = "0.15.7", optional = true }
|
||||||
|
serde = { version = "1.0.228", features = ["derive"] }
|
||||||
|
serde_json = "1.0.145"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["web"]
|
default = ["web"]
|
||||||
web = ["dioxus/web"]
|
web = ["dioxus/web"]
|
||||||
desktop = ["dioxus/desktop"]
|
desktop = ["dioxus/desktop"]
|
||||||
mobile = ["dioxus/mobile"]
|
mobile = ["dioxus/mobile"]
|
||||||
server = ["dioxus/server", "dep:tokio"]
|
server = [
|
||||||
|
"dioxus/server",
|
||||||
|
"dep:tokio",
|
||||||
|
"dep:axum",
|
||||||
|
"dep:argon2",
|
||||||
|
"dep:sea-orm",
|
||||||
|
"dep:dotenvy",
|
||||||
|
]
|
||||||
|
|||||||
@ -7,6 +7,17 @@
|
|||||||
'Noto Color Emoji';
|
'Noto Color Emoji';
|
||||||
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
|
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
|
||||||
monospace;
|
monospace;
|
||||||
|
--color-red-500: oklch(63.7% 0.237 25.331);
|
||||||
|
--color-green-500: oklch(72.3% 0.219 149.579);
|
||||||
|
--color-green-600: oklch(62.7% 0.194 149.214);
|
||||||
|
--color-blue-500: oklch(62.3% 0.214 259.815);
|
||||||
|
--color-blue-600: oklch(54.6% 0.245 262.881);
|
||||||
|
--color-gray-800: oklch(27.8% 0.033 256.848);
|
||||||
|
--color-white: #fff;
|
||||||
|
--spacing: 0.25rem;
|
||||||
|
--text-2xl: 1.5rem;
|
||||||
|
--text-2xl--line-height: calc(2 / 1.5);
|
||||||
|
--font-weight-bold: 700;
|
||||||
--default-font-family: var(--font-sans);
|
--default-font-family: var(--font-sans);
|
||||||
--default-mono-font-family: var(--font-mono);
|
--default-mono-font-family: var(--font-mono);
|
||||||
}
|
}
|
||||||
@ -181,28 +192,91 @@
|
|||||||
max-width: 96rem;
|
max-width: 96rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.mb-4 {
|
||||||
|
margin-bottom: calc(var(--spacing) * 4);
|
||||||
|
}
|
||||||
|
.flex {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
.table {
|
.table {
|
||||||
display: table;
|
display: table;
|
||||||
}
|
}
|
||||||
.border-collapse {
|
.min-h-screen {
|
||||||
border-collapse: collapse;
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
.w-64 {
|
||||||
|
width: calc(var(--spacing) * 64);
|
||||||
}
|
}
|
||||||
.transform {
|
.transform {
|
||||||
transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);
|
transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);
|
||||||
}
|
}
|
||||||
.resize {
|
.flex-col {
|
||||||
resize: both;
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.items-center {
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.justify-center {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.gap-4 {
|
||||||
|
gap: calc(var(--spacing) * 4);
|
||||||
|
}
|
||||||
|
.rounded {
|
||||||
|
border-radius: 0.25rem;
|
||||||
}
|
}
|
||||||
.border {
|
.border {
|
||||||
border-style: var(--tw-border-style);
|
border-style: var(--tw-border-style);
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
}
|
}
|
||||||
.underline {
|
.bg-blue-500 {
|
||||||
text-decoration-line: underline;
|
background-color: var(--color-blue-500);
|
||||||
}
|
}
|
||||||
.outline {
|
.bg-gray-800 {
|
||||||
outline-style: var(--tw-outline-style);
|
background-color: var(--color-gray-800);
|
||||||
outline-width: 1px;
|
}
|
||||||
|
.bg-green-500 {
|
||||||
|
background-color: var(--color-green-500);
|
||||||
|
}
|
||||||
|
.p-2 {
|
||||||
|
padding: calc(var(--spacing) * 2);
|
||||||
|
}
|
||||||
|
.p-4 {
|
||||||
|
padding: calc(var(--spacing) * 4);
|
||||||
|
}
|
||||||
|
.py-2 {
|
||||||
|
padding-block: calc(var(--spacing) * 2);
|
||||||
|
}
|
||||||
|
.text-2xl {
|
||||||
|
font-size: var(--text-2xl);
|
||||||
|
line-height: var(--tw-leading, var(--text-2xl--line-height));
|
||||||
|
}
|
||||||
|
.font-bold {
|
||||||
|
--tw-font-weight: var(--font-weight-bold);
|
||||||
|
font-weight: var(--font-weight-bold);
|
||||||
|
}
|
||||||
|
.text-green-500 {
|
||||||
|
color: var(--color-green-500);
|
||||||
|
}
|
||||||
|
.text-red-500 {
|
||||||
|
color: var(--color-red-500);
|
||||||
|
}
|
||||||
|
.text-white {
|
||||||
|
color: var(--color-white);
|
||||||
|
}
|
||||||
|
.hover\:bg-blue-600 {
|
||||||
|
&:hover {
|
||||||
|
@media (hover: hover) {
|
||||||
|
background-color: var(--color-blue-600);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.hover\:bg-green-600 {
|
||||||
|
&:hover {
|
||||||
|
@media (hover: hover) {
|
||||||
|
background-color: var(--color-green-600);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@property --tw-rotate-x {
|
@property --tw-rotate-x {
|
||||||
@ -230,10 +304,9 @@
|
|||||||
inherits: false;
|
inherits: false;
|
||||||
initial-value: solid;
|
initial-value: solid;
|
||||||
}
|
}
|
||||||
@property --tw-outline-style {
|
@property --tw-font-weight {
|
||||||
syntax: "*";
|
syntax: "*";
|
||||||
inherits: false;
|
inherits: false;
|
||||||
initial-value: solid;
|
|
||||||
}
|
}
|
||||||
@layer properties {
|
@layer properties {
|
||||||
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
||||||
@ -244,7 +317,7 @@
|
|||||||
--tw-skew-x: initial;
|
--tw-skew-x: initial;
|
||||||
--tw-skew-y: initial;
|
--tw-skew-y: initial;
|
||||||
--tw-border-style: solid;
|
--tw-border-style: solid;
|
||||||
--tw-outline-style: solid;
|
--tw-font-weight: initial;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
60
src/auth.rs
Normal file
60
src/auth.rs
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
#[cfg(feature = "server")]
|
||||||
|
use crate::db::{self, Entity as User};
|
||||||
|
#[cfg(feature = "server")]
|
||||||
|
use argon2::{
|
||||||
|
password_hash::{rand_core::OsRng, PasswordHash, PasswordHasher, PasswordVerifier, SaltString},
|
||||||
|
Argon2,
|
||||||
|
};
|
||||||
|
use dioxus::prelude::*;
|
||||||
|
#[cfg(feature = "server")]
|
||||||
|
use sea_orm::*;
|
||||||
|
|
||||||
|
#[server]
|
||||||
|
pub async fn register(username: String, password: String) -> Result<String, ServerFnError> {
|
||||||
|
let db = db::establish_connection()
|
||||||
|
.await
|
||||||
|
.map_err(|e| ServerFnError::new(e.to_string()))?;
|
||||||
|
|
||||||
|
let salt = SaltString::generate(&mut OsRng);
|
||||||
|
let argon2 = Argon2::default();
|
||||||
|
let password_hash = argon2
|
||||||
|
.hash_password(password.as_bytes(), &salt)
|
||||||
|
.map_err(|e| ServerFnError::new(e.to_string()))?
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
let new_user = db::ActiveModel {
|
||||||
|
username: Set(username),
|
||||||
|
password: Set(password_hash),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
let _user = new_user
|
||||||
|
.insert(&db)
|
||||||
|
.await
|
||||||
|
.map_err(|e| ServerFnError::new(e.to_string()))?;
|
||||||
|
|
||||||
|
Ok("User registered successfully".to_string())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[server]
|
||||||
|
pub async fn login(username: String, password: String) -> Result<String, ServerFnError> {
|
||||||
|
let db = db::establish_connection()
|
||||||
|
.await
|
||||||
|
.map_err(|e| ServerFnError::new(e.to_string()))?;
|
||||||
|
|
||||||
|
let user = User::find()
|
||||||
|
.filter(db::Column::Username.eq(username))
|
||||||
|
.one(&db)
|
||||||
|
.await
|
||||||
|
.map_err(|e| ServerFnError::new(e.to_string()))?
|
||||||
|
.ok_or(ServerFnError::new("User not found"))?;
|
||||||
|
|
||||||
|
let parsed_hash =
|
||||||
|
PasswordHash::new(&user.password).map_err(|e| ServerFnError::new(e.to_string()))?;
|
||||||
|
|
||||||
|
Argon2::default()
|
||||||
|
.verify_password(password.as_bytes(), &parsed_hash)
|
||||||
|
.map_err(|_| ServerFnError::new("Invalid password"))?;
|
||||||
|
|
||||||
|
Ok("Login successful".to_string())
|
||||||
|
}
|
||||||
34
src/db.rs
Normal file
34
src/db.rs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
use sea_orm::entity::prelude::*;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
||||||
|
#[sea_orm(table_name = "users")]
|
||||||
|
pub struct Model {
|
||||||
|
#[sea_orm(primary_key)]
|
||||||
|
pub id: i32,
|
||||||
|
#[sea_orm(unique)]
|
||||||
|
pub username: String,
|
||||||
|
pub password: String, // Argon2 hashed
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||||
|
pub enum Relation {}
|
||||||
|
|
||||||
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
|
|
||||||
|
use sea_orm::{Database, DatabaseConnection, DbErr, Schema};
|
||||||
|
|
||||||
|
pub async fn establish_connection() -> Result<DatabaseConnection, DbErr> {
|
||||||
|
let database_url =
|
||||||
|
std::env::var("DATABASE_URL").unwrap_or("sqlite://wichtl.db?mode=rwc".to_owned());
|
||||||
|
let db = Database::connect(&database_url).await?;
|
||||||
|
|
||||||
|
// Create table if not exists
|
||||||
|
let builder = db.get_database_backend();
|
||||||
|
let schema = Schema::new(builder);
|
||||||
|
let create_table_op = schema.create_table_from_entity(Entity);
|
||||||
|
|
||||||
|
let _ = db.execute(builder.build(&create_table_op)).await;
|
||||||
|
|
||||||
|
Ok(db)
|
||||||
|
}
|
||||||
177
src/main.rs
177
src/main.rs
@ -1,4 +1,7 @@
|
|||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
mod auth;
|
||||||
|
#[cfg(feature = "server")]
|
||||||
|
mod db;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Routable, PartialEq)]
|
#[derive(Debug, Clone, Routable, PartialEq)]
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
@ -6,13 +9,13 @@ enum Route {
|
|||||||
#[layout(Navbar)]
|
#[layout(Navbar)]
|
||||||
#[route("/")]
|
#[route("/")]
|
||||||
Home {},
|
Home {},
|
||||||
#[route("/blog/:id")]
|
#[route("/login")]
|
||||||
Blog { id: i32 },
|
Login {},
|
||||||
|
#[route("/register")]
|
||||||
|
Register {},
|
||||||
}
|
}
|
||||||
|
|
||||||
const FAVICON: Asset = asset!("/assets/favicon.ico");
|
|
||||||
const MAIN_CSS: Asset = asset!("/assets/main.css");
|
const MAIN_CSS: Asset = asset!("/assets/main.css");
|
||||||
const HEADER_SVG: Asset = asset!("/assets/header.svg");
|
|
||||||
const TAILWIND_CSS: Asset = asset!("/assets/tailwind.css");
|
const TAILWIND_CSS: Asset = asset!("/assets/tailwind.css");
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -22,63 +25,25 @@ fn main() {
|
|||||||
#[component]
|
#[component]
|
||||||
fn App() -> Element {
|
fn App() -> Element {
|
||||||
rsx! {
|
rsx! {
|
||||||
document::Link { rel: "icon", href: FAVICON }
|
document::Link { rel: "stylesheet", href: MAIN_CSS } document::Link { rel: "stylesheet", href: TAILWIND_CSS }
|
||||||
document::Link { rel: "stylesheet", href: MAIN_CSS } document::Link { rel: "stylesheet", href: TAILWIND_CSS }
|
document::Link { rel: "stylesheet", href: MAIN_CSS } document::Link { rel: "stylesheet", href: TAILWIND_CSS }
|
||||||
Router::<Route> {}
|
Router::<Route> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
/// Home page
|
||||||
pub fn Hero() -> Element {
|
|
||||||
rsx! {
|
|
||||||
div {
|
|
||||||
id: "hero",
|
|
||||||
img { src: HEADER_SVG, id: "header" }
|
|
||||||
div { id: "links",
|
|
||||||
a { href: "https://dioxuslabs.com/learn/0.7/", "📚 Learn Dioxus" }
|
|
||||||
a { href: "https://dioxuslabs.com/awesome", "🚀 Awesome Dioxus" }
|
|
||||||
a { href: "https://github.com/dioxus-community/", "📡 Community Libraries" }
|
|
||||||
a { href: "https://github.com/DioxusLabs/sdk", "⚙️ Dioxus Development Kit" }
|
|
||||||
a { href: "https://marketplace.visualstudio.com/items?itemName=DioxusLabs.dioxus", "💫 VSCode Extension" }
|
|
||||||
a { href: "https://discord.gg/XgGxMSkvUM", "👋 Community Discord" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Home page
|
/// Home page
|
||||||
#[component]
|
#[component]
|
||||||
fn Home() -> Element {
|
fn Home() -> Element {
|
||||||
rsx! {
|
rsx! {
|
||||||
Hero {}
|
div {
|
||||||
Echo {}
|
class: "flex flex-col items-center justify-center min-h-screen py-2",
|
||||||
|
h1 { "Welcome to Wichtl" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Blog page
|
/// Blog page
|
||||||
#[component]
|
|
||||||
pub fn Blog(id: i32) -> Element {
|
|
||||||
rsx! {
|
|
||||||
div {
|
|
||||||
id: "blog",
|
|
||||||
|
|
||||||
// Content
|
|
||||||
h1 { "This is blog #{id}!" }
|
|
||||||
p { "In blog #{id}, we show how the Dioxus router works and how URL parameters can be passed as props to our route components." }
|
|
||||||
|
|
||||||
// Navigation links
|
|
||||||
Link {
|
|
||||||
to: Route::Blog { id: id - 1 },
|
|
||||||
"Previous"
|
|
||||||
}
|
|
||||||
span { " <---> " }
|
|
||||||
Link {
|
|
||||||
to: Route::Blog { id: id + 1 },
|
|
||||||
"Next"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Shared navbar component.
|
/// Shared navbar component.
|
||||||
#[component]
|
#[component]
|
||||||
@ -86,13 +51,18 @@ fn Navbar() -> Element {
|
|||||||
rsx! {
|
rsx! {
|
||||||
div {
|
div {
|
||||||
id: "navbar",
|
id: "navbar",
|
||||||
|
class: "flex gap-4 p-4 bg-gray-800 text-white",
|
||||||
Link {
|
Link {
|
||||||
to: Route::Home {},
|
to: Route::Home {},
|
||||||
"Home"
|
"Home"
|
||||||
}
|
}
|
||||||
Link {
|
Link {
|
||||||
to: Route::Blog { id: 1 },
|
to: Route::Login {},
|
||||||
"Blog"
|
"Login"
|
||||||
|
}
|
||||||
|
Link {
|
||||||
|
to: Route::Register {},
|
||||||
|
"Register"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,35 +70,100 @@ fn Navbar() -> Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Echo component that demonstrates fullstack server functions.
|
|
||||||
#[component]
|
#[component]
|
||||||
fn Echo() -> Element {
|
fn Login() -> Element {
|
||||||
let mut response = use_signal(|| String::new());
|
let mut username = use_signal(|| String::new());
|
||||||
|
let mut password = use_signal(|| String::new());
|
||||||
|
let mut error = use_signal(|| String::new());
|
||||||
|
let mut success = use_signal(|| String::new());
|
||||||
|
|
||||||
rsx! {
|
rsx! {
|
||||||
div {
|
div {
|
||||||
id: "echo",
|
class: "flex flex-col items-center justify-center min-h-screen py-2",
|
||||||
h4 { "ServerFn Echo" }
|
h1 { class: "text-2xl font-bold mb-4", "Login" }
|
||||||
input {
|
div {
|
||||||
placeholder: "Type here to echo...",
|
class: "flex flex-col gap-4 w-64",
|
||||||
oninput: move |event| async move {
|
input {
|
||||||
let data = echo_server(event.value()).await.unwrap();
|
class: "border p-2 rounded",
|
||||||
response.set(data);
|
placeholder: "Username",
|
||||||
},
|
value: "{username}",
|
||||||
}
|
oninput: move |e| username.set(e.value())
|
||||||
|
}
|
||||||
if !response().is_empty() {
|
input {
|
||||||
p {
|
class: "border p-2 rounded",
|
||||||
"Server echoed: "
|
type: "password",
|
||||||
i { "{response}" }
|
placeholder: "Password",
|
||||||
|
value: "{password}",
|
||||||
|
oninput: move |e| password.set(e.value())
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
class: "bg-blue-500 text-white p-2 rounded hover:bg-blue-600",
|
||||||
|
onclick: move |_| async move {
|
||||||
|
error.set("".to_string());
|
||||||
|
success.set("".to_string());
|
||||||
|
match auth::login(username(), password()).await {
|
||||||
|
Ok(msg) => success.set(msg),
|
||||||
|
Err(e) => error.set(e.to_string()),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Login"
|
||||||
|
}
|
||||||
|
if !error().is_empty() {
|
||||||
|
p { class: "text-red-500", "{error}" }
|
||||||
|
}
|
||||||
|
if !success().is_empty() {
|
||||||
|
p { class: "text-green-500", "{success}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Echo the user input on the server.
|
#[component]
|
||||||
#[post("/api/echo")]
|
fn Register() -> Element {
|
||||||
async fn echo_server(input: String) -> Result<String, ServerFnError> {
|
let mut username = use_signal(|| String::new());
|
||||||
Ok(input)
|
let mut password = use_signal(|| String::new());
|
||||||
|
let mut error = use_signal(|| String::new());
|
||||||
|
let mut success = use_signal(|| String::new());
|
||||||
|
|
||||||
|
rsx! {
|
||||||
|
div {
|
||||||
|
class: "flex flex-col items-center justify-center min-h-screen py-2",
|
||||||
|
h1 { class: "text-2xl font-bold mb-4", "Register" }
|
||||||
|
div {
|
||||||
|
class: "flex flex-col gap-4 w-64",
|
||||||
|
input {
|
||||||
|
class: "border p-2 rounded",
|
||||||
|
placeholder: "Username",
|
||||||
|
value: "{username}",
|
||||||
|
oninput: move |e| username.set(e.value())
|
||||||
|
}
|
||||||
|
input {
|
||||||
|
class: "border p-2 rounded",
|
||||||
|
type: "password",
|
||||||
|
placeholder: "Password",
|
||||||
|
value: "{password}",
|
||||||
|
oninput: move |e| password.set(e.value())
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
class: "bg-green-500 text-white p-2 rounded hover:bg-green-600",
|
||||||
|
onclick: move |_| async move {
|
||||||
|
error.set("".to_string());
|
||||||
|
success.set("".to_string());
|
||||||
|
match auth::register(username(), password()).await {
|
||||||
|
Ok(msg) => success.set(msg),
|
||||||
|
Err(e) => error.set(e.to_string()),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Register"
|
||||||
|
}
|
||||||
|
if !error().is_empty() {
|
||||||
|
p { class: "text-red-500", "{error}" }
|
||||||
|
}
|
||||||
|
if !success().is_empty() {
|
||||||
|
p { class: "text-green-500", "{success}" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user