...
This commit is contained in:
parent
1b08d57924
commit
17a11fb43c
@ -25,7 +25,7 @@ impl AuthController {
|
|||||||
pub async fn login(
|
pub async fn login(
|
||||||
form: web::Form<LoginCredentials>,
|
form: web::Form<LoginCredentials>,
|
||||||
session: Session,
|
session: Session,
|
||||||
tmpl: web::Data<Tera>
|
_tmpl: web::Data<Tera>
|
||||||
) -> Result<impl Responder> {
|
) -> Result<impl Responder> {
|
||||||
// In a real application, you would validate the credentials against a database
|
// In a real application, you would validate the credentials against a database
|
||||||
// For this example, we'll use a hardcoded user
|
// For this example, we'll use a hardcoded user
|
||||||
@ -51,14 +51,6 @@ impl AuthController {
|
|||||||
Ok(HttpResponse::Found()
|
Ok(HttpResponse::Found()
|
||||||
.append_header(("Location", "/"))
|
.append_header(("Location", "/"))
|
||||||
.finish())
|
.finish())
|
||||||
|
|
||||||
let rendered = tmpl.render("auth/login.html", &ctx)
|
|
||||||
.map_err(|e| {
|
|
||||||
eprintln!("Template rendering error: {}", e);
|
|
||||||
actix_web::error::ErrorInternalServerError("Template rendering error")
|
|
||||||
})?;
|
|
||||||
|
|
||||||
Ok(HttpResponse::Ok().content_type("text/html").body(rendered))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Renders the registration page
|
/// Renders the registration page
|
||||||
@ -79,7 +71,7 @@ impl AuthController {
|
|||||||
pub async fn register(
|
pub async fn register(
|
||||||
form: web::Form<RegistrationData>,
|
form: web::Form<RegistrationData>,
|
||||||
session: Session,
|
session: Session,
|
||||||
tmpl: web::Data<Tera>
|
_tmpl: web::Data<Tera>
|
||||||
) -> Result<impl Responder> {
|
) -> Result<impl Responder> {
|
||||||
// Skip validation and always create an admin user
|
// Skip validation and always create an admin user
|
||||||
let mut user = User::new(
|
let mut user = User::new(
|
||||||
|
@ -203,7 +203,7 @@ impl TicketController {
|
|||||||
pub async fn create_ticket(
|
pub async fn create_ticket(
|
||||||
session: Session,
|
session: Session,
|
||||||
form: web::Form<NewTicketForm>,
|
form: web::Form<NewTicketForm>,
|
||||||
tmpl: web::Data<Tera>
|
_tmpl: web::Data<Tera>
|
||||||
) -> Result<impl Responder> {
|
) -> Result<impl Responder> {
|
||||||
// Get the current user from the session
|
// Get the current user from the session
|
||||||
let user = match session.get::<String>("user")? {
|
let user = match session.get::<String>("user")? {
|
||||||
|
Loading…
Reference in New Issue
Block a user