...
This commit is contained in:
		@@ -25,7 +25,7 @@ impl AuthController {
 | 
			
		||||
    pub async fn login(
 | 
			
		||||
        form: web::Form<LoginCredentials>,
 | 
			
		||||
        session: Session,
 | 
			
		||||
        tmpl: web::Data<Tera>
 | 
			
		||||
        _tmpl: web::Data<Tera>
 | 
			
		||||
    ) -> Result<impl Responder> {
 | 
			
		||||
        // In a real application, you would validate the credentials against a database
 | 
			
		||||
        // For this example, we'll use a hardcoded user
 | 
			
		||||
@@ -51,14 +51,6 @@ impl AuthController {
 | 
			
		||||
        Ok(HttpResponse::Found()
 | 
			
		||||
            .append_header(("Location", "/"))
 | 
			
		||||
            .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
 | 
			
		||||
@@ -79,7 +71,7 @@ impl AuthController {
 | 
			
		||||
    pub async fn register(
 | 
			
		||||
        form: web::Form<RegistrationData>,
 | 
			
		||||
        session: Session,
 | 
			
		||||
        tmpl: web::Data<Tera>
 | 
			
		||||
        _tmpl: web::Data<Tera>
 | 
			
		||||
    ) -> Result<impl Responder> {
 | 
			
		||||
        // Skip validation and always create an admin user
 | 
			
		||||
        let mut user = User::new(
 | 
			
		||||
 
 | 
			
		||||
@@ -203,7 +203,7 @@ impl TicketController {
 | 
			
		||||
    pub async fn create_ticket(
 | 
			
		||||
        session: Session,
 | 
			
		||||
        form: web::Form<NewTicketForm>,
 | 
			
		||||
        tmpl: web::Data<Tera>
 | 
			
		||||
        _tmpl: web::Data<Tera>
 | 
			
		||||
    ) -> Result<impl Responder> {
 | 
			
		||||
        // Get the current user from the session
 | 
			
		||||
        let user = match session.get::<String>("user")? {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user