Skip to content

Commit

Permalink
Two-factor disenroll button, other fixes for authy support
Browse files Browse the repository at this point in the history
  • Loading branch information
jcameron committed Sep 28, 2013
1 parent caaff31 commit 7b95e94
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion acl/edit_user.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ if ($user{'twofactor_provider'}) {
&webmin::list_twofactor_providers();
print &ui_table_row($text{'edit_twofactor'},
&text('edit_twofactorprov', "<i>$prov->[1]</i>",
"<tt>$user{'twofactor_id'}</tt>"));
"<tt>$user{'twofactor_id'}</tt>")."<br>\n".
&ui_checkbox('cancel', 1, $text{'edit_twofactorcancel'}, 0));
}

print &ui_hidden_table_end("security");
Expand Down
1 change: 1 addition & 0 deletions acl/index.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ return ($config{'select'} ? "" : &ui_checkbox("d", $_[0]->{'name'}, "", 0)).
($ro ? "<b>" : "").
"<a href='$_[1]?$_[2]=".&urlize($_[0]->{'name'})."'>".
$_[0]->{'name'}."</a>".
($_[0]->{'twofactor_id'} ? "*" : "").
($ro ? "</b>" : "").
($lck ? "</i>" : "");
}
Expand Down
1 change: 1 addition & 0 deletions acl/lang/en
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ edit_modules=Modules
edit_clone=Clone
edit_twofactor=Two-factor authentication type
edit_twofactorprov=Using provider $1 with ID $2
edit_twofactorcancel=Remove two-factor authentication requirement
edit_lang=Language
edit_notabs=Categorise modules?
edit_logout=Inactivity logout time
Expand Down
6 changes: 6 additions & 0 deletions acl/save_user.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,12 @@ elsif ($in{'lock'} && $user{'pass'} !~ /^\!/ && $in{'pass_def'} <= 1) {
# Check for force change
$user{'temppass'} = $in{'temp'};

# Cancel two-factor if requested
if ($in{'cancel'}) {
$user->{'twofactor_provider'} = undef;
$user->{'twofactor_id'} = undef;
}

if ($in{'old'}) {
# update user and all ACLs
&modify_user($in{'old'}, \%user);
Expand Down
3 changes: 3 additions & 0 deletions miniserv.pl
Original file line number Diff line number Diff line change
Expand Up @@ -5921,6 +5921,9 @@ sub html_escape
sub validate_twofactor
{
my ($user, $token) = @_;
$token =~ s/^\s+//;
$token =~ s/\s+$//;
$token || return "No two-factor token entered";
my $tf = $twofactor{$user};
$tf || return undef;
pipe(TOKENr, TOKENw);
Expand Down
3 changes: 2 additions & 1 deletion session_login.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ print &ui_table_row($text{'session_pass'},
# Two-factor token, for users that have it
if ($miniserv{'twofactor_provider'}) {
print &ui_table_row($text{'session_twofactor'},
&ui_textbox("twofactor", undef, 20, 0, undef, $tags));
&ui_textbox("twofactor", undef, 20, 0, undef,
"autocomplete=off"));
}

# Remember session cookie?
Expand Down

0 comments on commit 7b95e94

Please sign in to comment.