single-user-edit-page #990
| @@ -115,7 +115,7 @@ test("Cox can start and finish trip", async ({ page }, testInfo) => { | ||||
|   await page.getByPlaceholder("Passwort").press("Enter"); | ||||
|  | ||||
|   await page.goto("/log/show"); | ||||
|   await page.getByText('(cox2)').click(); | ||||
|   await page.getByRole('link', { name: 'Joe' }).nth(1).click(); | ||||
|   page.once("dialog", (dialog) => { | ||||
|     dialog.accept().catch(() => {}); | ||||
|   }); | ||||
| @@ -208,7 +208,6 @@ test("Kiosk can start and finish trip", async ({ page }, testInfo) => { | ||||
|  | ||||
|   await page.getByRole('link', { name: 'Logbuch' }).click(); | ||||
|   await expect(page.locator('body')).toContainText('Joe'); | ||||
|   await expect(page.locator('body')).toContainText('(cox2)'); | ||||
|   await expect(page.locator('body')).toContainText('Ottensheim (25 km)'); | ||||
|   await expect(page.locator('body')).toContainText('Ruderer: cox2, rower2'); | ||||
|    | ||||
| @@ -225,7 +224,7 @@ test("Kiosk can start and finish trip", async ({ page }, testInfo) => { | ||||
|   await page.getByPlaceholder("Passwort").press("Enter"); | ||||
|  | ||||
|   await page.goto("/log/show"); | ||||
|   await page.getByText('(cox2)').click(); | ||||
|   await page.getByRole('link', { name: 'Joe' }).nth(1).click(); | ||||
|   page.once("dialog", (dialog) => { | ||||
|     dialog.accept().catch(() => {}); | ||||
|   }); | ||||
| @@ -286,7 +285,6 @@ test("Cox can start and finish trip with cox steering only", async ({ page }, te | ||||
|  | ||||
|   await page.goto('/log/show'); | ||||
|   await expect(page.locator('body')).toContainText('cox_only_steering_boat'); | ||||
|   await expect(page.locator('body')).toContainText('(cox2 - handgesteuert)'); | ||||
|   await expect(page.locator('body')).toContainText('Ottensheim (25 km)'); | ||||
|    | ||||
|  | ||||
| @@ -302,7 +300,7 @@ test("Cox can start and finish trip with cox steering only", async ({ page }, te | ||||
|   await page.getByPlaceholder("Passwort").press("Enter"); | ||||
|  | ||||
|   await page.goto("/log/show"); | ||||
|   await page.getByText('(cox2 - handgesteuert)').click(); | ||||
|   await page.getByRole("link", { name: "cox_only_steering_boat" }).click(); | ||||
|   page.once("dialog", (dialog) => { | ||||
|     dialog.accept().catch(() => {}); | ||||
|   }); | ||||
| @@ -371,7 +369,7 @@ test("Kiosk can start and finish trip in one stop", async ({ page }, testInfo) = | ||||
|   await page.getByPlaceholder("Passwort").press("Enter"); | ||||
|  | ||||
|   await page.goto("/log/show"); | ||||
|   await page.getByText('(cox2)').click(); | ||||
|   await page.getByRole('link', { name: 'Joe' }).nth(1).click(); | ||||
|   page.once("dialog", (dialog) => { | ||||
|     dialog.accept().catch(() => {}); | ||||
|   }); | ||||
|   | ||||
| @@ -577,10 +577,6 @@ ASKÖ Ruderverein Donau Linz", self.name), | ||||
|         .execute(db) | ||||
|         .await | ||||
|         .unwrap(); //Okay, because we can only create a User of a valid id | ||||
|         ActivityBuilder::new(&format!("User {self} hat sich eingeloggt.")) | ||||
|             .relevant_for_user(self) | ||||
|             .save(db) | ||||
|             .await; | ||||
|     } | ||||
|  | ||||
|     pub async fn delete(&self, db: &SqlitePool, deleted_by: &ManageUserUser) { | ||||
|   | ||||
| @@ -1,5 +1,4 @@ | ||||
| use rocket::{ | ||||
|     FromForm, Request, Route, State, | ||||
|     form::Form, | ||||
|     get, | ||||
|     http::{Cookie, CookieJar}, | ||||
| @@ -9,11 +8,13 @@ use rocket::{ | ||||
|     response::{Flash, Redirect}, | ||||
|     routes, | ||||
|     time::{Duration, OffsetDateTime}, | ||||
|     FromForm, Request, Route, State, | ||||
| }; | ||||
| use rocket_dyn_templates::{Template, context, tera}; | ||||
| use rocket_dyn_templates::{context, tera, Template}; | ||||
| use sqlx::SqlitePool; | ||||
|  | ||||
| use crate::model::{ | ||||
|     activity::ActivityBuilder, | ||||
|     log::Log, | ||||
|     user::{LoginError, User}, | ||||
| }; | ||||
| @@ -82,13 +83,12 @@ async fn login( | ||||
|  | ||||
|     cookies.add_private(Cookie::new("loggedin_user", format!("{}", user.id))); | ||||
|  | ||||
|     Log::create( | ||||
|         db, | ||||
|         format!( | ||||
|             "Succ login of {} with this useragent: {}", | ||||
|             login.name, agent.0 | ||||
|         ), | ||||
|     ) | ||||
|     ActivityBuilder::new(&format!( | ||||
|         "{user} hat sich eingeloggt (User-Agent: {})", | ||||
|         agent.0 | ||||
|     )) | ||||
|     .relevant_for_user(&user) | ||||
|     .save(db) | ||||
|     .await; | ||||
|  | ||||
|     // Check for redirect_url cookie and redirect accordingly | ||||
|   | ||||
| @@ -26,7 +26,7 @@ | ||||
|             {% for log in logs %} | ||||
|                 {% set_global allowed_to_edit = false %} | ||||
|                 {% if loggedin_user %} | ||||
|                     {% if "Vorstand" in loggedin_user.roles %} | ||||
|                     {% if "Vorstand" in loggedin_user.roles or "admin" in loggedin_user.roles %} | ||||
|                         {% set_global allowed_to_edit = true %} | ||||
|                     {% endif %} | ||||
|                 {% endif %} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user