Skip to content

Commit

Permalink
Remove hasPassword support
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanvelzen committed Jul 2, 2024
1 parent 52d69f3 commit 16ceaf6
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import java.time.Instant
data class AuthenticationStoreUser(
val name: String,
@SerialName("last_used") val lastUsed: Long = Instant.now().toEpochMilli(),
@SerialName("require_password") val requirePassword: Boolean = true,
@SerialName("image_tag") val imageTag: String? = null,
@SerialName("access_token") val accessToken: String? = null,
)
3 changes: 0 additions & 3 deletions app/src/main/java/org/jellyfin/androidtv/auth/model/User.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ sealed class User {
abstract val serverId: UUID
abstract val name: String
abstract val accessToken: String?
abstract val requirePassword: Boolean
abstract val imageTag: String?

abstract fun withToken(accessToken: String): User
Expand All @@ -34,7 +33,6 @@ data class PrivateUser(
override val serverId: UUID,
override val name: String,
override val accessToken: String?,
override val requirePassword: Boolean,
override val imageTag: String?,
val lastUsed: Long,
) : User() {
Expand All @@ -49,7 +47,6 @@ data class PublicUser(
override val serverId: UUID,
override val name: String,
override val accessToken: String?,
override val requirePassword: Boolean,
override val imageTag: String?,
) : User() {
override fun withToken(accessToken: String) = copy(accessToken = accessToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ class AuthenticationRepositoryImpl(
val authStoreUser = authenticationStore.getUser(server.id, user.id)
// Try login with access token
return if (authStoreUser?.accessToken != null) authenticateToken(server, user.withToken(authStoreUser.accessToken))
// Try login without password
else if (!user.requirePassword) authenticateCredential(server, user.name, "")
// Require login
else flowOf(RequireSignInState)
}
Expand Down Expand Up @@ -124,7 +122,6 @@ class AuthenticationRepositoryImpl(
serverId = server.id,
name = userInfo.name!!,
accessToken = result.accessToken,
requirePassword = userInfo.hasPassword,
imageTag = userInfo.primaryImageTag,
lastUsed = Instant.now().toEpochMilli(),
)
Expand Down Expand Up @@ -166,12 +163,10 @@ class AuthenticationRepositoryImpl(
val updatedUser = currentUser?.copy(
name = userInfo.name!!,
lastUsed = Instant.now().toEpochMilli(),
requirePassword = userInfo.hasPassword,
imageTag = userInfo.primaryImageTag,
accessToken = accessToken,
) ?: AuthenticationStoreUser(
name = userInfo.name!!,
requirePassword = userInfo.hasPassword,
imageTag = userInfo.primaryImageTag,
accessToken = accessToken,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class ServerUserRepositoryImpl(
serverId = server.id,
name = userInfo.name,
accessToken = authInfo?.accessToken,
requirePassword = userInfo.requirePassword,
imageTag = userInfo.imageTag,
lastUsed = userInfo.lastUsed,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ fun UserDto.toPublicUser(): PublicUser? {
name = name ?: return null,
serverId = serverId?.toUUIDOrNull() ?: return null,
accessToken = null,
requirePassword = hasPassword,
imageTag = primaryImageTag
)
}
Expand Down

0 comments on commit 16ceaf6

Please sign in to comment.