Show context in polkit prompt

This commit is contained in:
David Heinemeier Hansson
2026-07-17 17:45:29 -07:00
parent 28d853402e
commit 73e5968c64
3 changed files with 47 additions and 1 deletions
+8 -1
View File
@@ -14,9 +14,16 @@ function fingerprintFirstFromPamConfig(raw) {
return false
}
function authorizationLabel(message) {
var text = String(message || "")
var match = text.match(/^Authentication is (?:needed|required) to run [`']([^`']+)[`'] as /i)
return match ? "Authorize running '" + match[1] + "'" : text
}
if (typeof module !== "undefined") {
module.exports = {
promptLooksFingerprint: promptLooksFingerprint,
fingerprintFirstFromPamConfig: fingerprintFirstFromPamConfig
fingerprintFirstFromPamConfig: fingerprintFirstFromPamConfig,
authorizationLabel: authorizationLabel
}
}