Files
PinPoint/app/src/main/java/com/example/jnicpp/bowling/AdminAuth.kt
T

32 lines
1.3 KiB
Kotlin
Raw Normal View History

2026-09-08 09:12:37 +08:00
/**
* @file AdminAuth.kt
* @brief Minimal local admin/normal-user distinction gating access to the tuning screen.
*/
package com.example.jnicpp.bowling
/**
* @brief Recognizes an admin login vs. a normal user for this local tool.
*
* Deliberately not a real multi-user account system -- there's no backend
* and no per-user data anywhere in this app. Just a single admin password
* checked locally: entering it correctly (see
* [BowlingCameraActivity]'s Tuning button) recognizes that login attempt
* as admin and unlocks [ParameterEditorActivity] for it; anyone who
* doesn't enter it stays a normal user with no access. Not persisted
* across app restarts or Tuning taps -- each attempt is checked fresh.
*/
object AdminAuth {
// Change this to your own value if you want a different admin
// password. Plain-text on purpose: this only gates a local tuning
// screen, not anything sensitive, so hashing/storage machinery would
// be complexity this tool doesn't need.
private const val ADMIN_PASSWORD = "admin123"
/**
* @brief Whether [password] matches the admin password.
* @param password The password entered at the login prompt.
* @return true if this login attempt should be recognized as admin.
*/
fun isAdminPassword(password: String): Boolean = password == ADMIN_PASSWORD
}