Skip to content

Commit

Permalink
polkitAuthenticationDialog: Use the new StPasswordEntry
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephMcc authored and clefebvre committed Nov 4, 2024
1 parent 9ea9d8f commit d368157
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions js/ui/polkitAuthenticationAgent.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ var AuthenticationDialog = GObject.registerClass({
vertical: true,
});

this._passwordEntry = new St.Entry({
this._passwordEntry = new St.PasswordEntry({
style_class: 'prompt-dialog-password-entry',
text: "",
can_focus: true,
visible: false,
x_align: Clutter.ActorAlign.CENTER,
});
CinnamonEntry.addContextMenu(this._passwordEntry, { isPassword: true });
CinnamonEntry.addContextMenu(this._passwordEntry);
this._passwordEntry.clutter_text.connect('activate', this._onEntryActivate.bind(this));
this._passwordEntry.bind_property('reactive',
this._passwordEntry.clutter_text, 'editable',
Expand All @@ -121,6 +121,12 @@ var AuthenticationDialog = GObject.registerClass({

let warningBox = new St.BoxLayout({ vertical: true });

let capsLockWarning = new CinnamonEntry.CapsLockWarning();
this._passwordEntry.bind_property('visible',
capsLockWarning, 'visible',
GObject.BindingFlags.SYNC_CREATE);
warningBox.add_child(capsLockWarning);

this._errorMessageLabel = new St.Label({
style_class: 'prompt-dialog-error-label',
visible: false,
Expand Down Expand Up @@ -292,10 +298,7 @@ var AuthenticationDialog = GObject.registerClass({
else
this._passwordEntry.hint_text = request;

if (echoOn)
this._passwordEntry.clutter_text.set_password_char('');
else
this._passwordEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE
this._passwordEntry.password_visible = echoOn;

this._passwordEntry.show();
this._passwordEntry.set_text('');
Expand Down

0 comments on commit d368157

Please sign in to comment.