Refactor code structure and remove redundant sections for improved readability and maintainability
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 47s
@@ -27,8 +27,8 @@ const activate = async (req, res, next) => {
|
||||
|
||||
const loginUser = async (req, res, next) => {
|
||||
try {
|
||||
const { email, password } = req.body;
|
||||
const result = await login(email, password);
|
||||
const { email, password, rememberMe } = req.body;
|
||||
const result = await login(email, password, { rememberMe });
|
||||
res.status(200).json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
@@ -37,7 +37,7 @@ const loginUser = async (req, res, next) => {
|
||||
|
||||
const logoutUser = async (req, res, next) => {
|
||||
try {
|
||||
const token = req.headers['authorization']?.split(' ')[1];
|
||||
const token = req.headers['authorization']?.split(' ')[1] || req.headers.authcode;
|
||||
const result = await logout(token);
|
||||
res.status(200).json(result);
|
||||
} catch (error) {
|
||||
|
||||
@@ -65,7 +65,7 @@ const activateUser = async (activationCode) => {
|
||||
return user;
|
||||
};
|
||||
|
||||
const login = async (email, password) => {
|
||||
const login = async (email, password, options = {}) => {
|
||||
if (!email || !password) {
|
||||
const err = new Error('Email und Passwort sind erforderlich.');
|
||||
err.status = 400;
|
||||
@@ -83,13 +83,17 @@ const login = async (email, password) => {
|
||||
err.status = 403;
|
||||
throw err;
|
||||
}
|
||||
const token = jwt.sign({ userId: user.id }, process.env.JWT_SECRET, { expiresIn: '3h' });
|
||||
const rememberMe = Boolean(options.rememberMe);
|
||||
const expiresInMs = rememberMe ? 90 * 24 * 3600 * 1000 : 3 * 3600 * 1000;
|
||||
const expiresIn = rememberMe ? '90d' : '3h';
|
||||
const expiresAt = new Date(Date.now() + expiresInMs);
|
||||
const token = jwt.sign({ userId: user.id }, process.env.JWT_SECRET, { expiresIn });
|
||||
await UserToken.create({
|
||||
userId: user.id,
|
||||
token,
|
||||
expiresAt: new Date(Date.now() + 3 * 3600 * 1000),
|
||||
expiresAt,
|
||||
});
|
||||
return { token };
|
||||
return { token, expiresAt: expiresAt.toISOString() };
|
||||
};
|
||||
|
||||
const logout = async (token) => {
|
||||
|
||||
BIN
mobile-app/composeApp/playstore/ic_launcher_foreground_512.png
Normal file
|
After Width: | Height: | Size: 193 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
|
Before Width: | Height: | Size: 151 KiB After Width: | Height: | Size: 151 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 47 KiB |
@@ -1,7 +1,7 @@
|
||||
[versions]
|
||||
# composeApp (Play Store / „Über die App“-Build)
|
||||
appVersionCode = "9"
|
||||
appVersionName = "1.3.3"
|
||||
appVersionCode = "11"
|
||||
appVersionName = "1.4.1"
|
||||
agp = "9.2.1"
|
||||
android-compileSdk = "35"
|
||||
android-minSdk = "24"
|
||||
|
||||
@@ -16,6 +16,9 @@ magick "$SRC" -resize 162x162! -filter Lanczos "$RES/drawable-hdpi/ic_launcher
|
||||
magick "$SRC" -resize 216x216! -filter Lanczos "$RES/drawable-xhdpi/ic_launcher_foreground.png"
|
||||
magick "$SRC" -resize 324x324! -filter Lanczos "$RES/drawable-xxhdpi/ic_launcher_foreground.png"
|
||||
magick "$SRC" -resize 432x432! -filter Lanczos "$RES/drawable-xxxhdpi/ic_launcher_foreground.png"
|
||||
# Erzeuge zusätzlich ein 512x512 PNG für den Play Store (Upload-Icon)
|
||||
mkdir -p "$ROOT/mobile-app/composeApp/playstore"
|
||||
magick "$SRC" -resize 512x512! -filter Lanczos "$ROOT/mobile-app/composeApp/playstore/ic_launcher_foreground_512.png"
|
||||
magick "$SRC" -resize 48x48! -filter Lanczos "$RES/mipmap-mdpi/ic_launcher.png"
|
||||
magick "$SRC" -resize 72x72! -filter Lanczos "$RES/mipmap-hdpi/ic_launcher.png"
|
||||
magick "$SRC" -resize 96x96! -filter Lanczos "$RES/mipmap-xhdpi/ic_launcher.png"
|
||||
|
||||
@@ -12,7 +12,7 @@ class AuthApi(
|
||||
) {
|
||||
suspend fun login(email: String, password: String): LoginResponse {
|
||||
return client.http.post("/api/auth/login") {
|
||||
setBody(LoginRequest(email = email, password = password))
|
||||
setBody(LoginRequest(email = email, password = password, rememberMe = true))
|
||||
}.body()
|
||||
}
|
||||
|
||||
@@ -20,4 +20,3 @@ class AuthApi(
|
||||
client.http.post("/api/auth/logout")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable
|
||||
data class LoginRequest(
|
||||
val email: String,
|
||||
val password: String,
|
||||
val rememberMe: Boolean = false,
|
||||
)
|
||||
|
||||
|
||||