forked from webmin/authentic-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
password_form.cgi
executable file
·103 lines (85 loc) · 4.07 KB
/
password_form.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/local/bin/perl
#
# Authentic Theme (https://github.com/authentic-theme/authentic-theme)
# Copyright Ilia Rostovtsev <[email protected]>
# Licensed under MIT (https://github.com/authentic-theme/authentic-theme/blob/master/LICENSE)
#
use strict;
our (%in, %gconfig, %text, $pragma_no_cache, %theme_text, %theme_config);
do($ENV{'THEME_ROOT'} . "/authentic-lib.pl");
$pragma_no_cache = 1;
$ENV{'MINISERV_INTERNAL'} || die "Can only be called by miniserv.pl";
my $charset = &get_charset();
&PrintHeader($charset);
print '<!DOCTYPE HTML>', "\n";
print '<html data-bgs="gainsboro" class="session_login">', "\n";
embed_login_head();
print '<body class="session_login">' . "\n";
print '<div class="container session_login">' . "\n";
if ($in{'expired'} == 2) {
print '<div class="alert alert-info">' . "\n";
print '<i class ="fa fa-exclamation-triangle"></i> ' . $text{'password_temp'} . '' . "\n";
print '</div>' . "\n";
} else {
print '<div class="alert alert-info">' . "\n";
print '<i class ="fa fa-exclamation-triangle"></i> ' . $text{'password_expired'} . '' . "\n";
print '</div>' . "\n";
}
# Start of the form
print "$text{'password_prefix'}\n";
print '<form method="post" target="_top" action="' . $gconfig{'webprefix'} .
'/password_change.cgi" class="form-signin session_login clearfix" role="form" onsubmit="spinner()">' . "\n";
print ui_hidden("user", $in{'user'});
print ui_hidden("pam", $in{'pam'});
print ui_hidden("expired", $in{'expired'});
print '<i class="wbm-webmin"></i><h2 class="form-signin-heading">
<span>'
. (&get_product_name() eq 'webmin' ? $theme_text{'theme_xhred_titles_wm'} :
$theme_text{'theme_xhred_titles_um'}
) .
'</span></h2>' . "\n";
# Process logo
embed_logo();
# Login message
my $host;
if ($gconfig{'realname'}) {
$host = &get_display_hostname();
} else {
$host = get_env('server_name');
$host =~ s/:\d+//g;
$host = &html_escape($host);
}
print '<p class="form-signin-paragraph">' .
theme_text('theme_new_password_header') . ' <em><strong>' . $in{'user'} . '</strong></em></p>' . "\n";
print '<div class="input-group form-group">' . "\n";
print '<span class="input-group-addon"><i class="fa fa-fw fa-key"></i></span>' . "\n";
print
'<input type="password" class="form-control session_login" name="old" autocomplete="off" autocorrect="off" placeholder="'
. theme_text('password_old')
. '">' . "\n";
print '</div>' . "\n";
print '<div class="input-group form-group">' . "\n";
print '<span class="input-group-addon"><i class="fa fa-fw fa-key-plus"></i></span>' . "\n";
print
'<input type="password" class="form-control session_login" name="new1" autocomplete="off" autocorrect="off" placeholder="'
. theme_text('password_new1')
. '">' . "\n";
print '</div>' . "\n";
print '<div class="input-group form-group">' . "\n";
print '<span class="input-group-addon"><i class="fa fa-fw fa-key-plus"></i></span>' . "\n";
print
'<input type="password" class="form-control session_login" name="new2" autocomplete="off" autocorrect="off" placeholder="'
. theme_text('password_new2')
. '">' . "\n";
print '</div>' . "\n";
print '<div class="form-group form-signin-group">';
print
'<button class="btn btn-primary" type="submit" style="margin-top: 0 !important; width: 100%"><i class="fa fa-unlock"></i> '
. &theme_text('password_ok')
. '</button>' . "\n";
print
'<script>document.addEventListener("DOMContentLoaded", function(event) {var l=document.querySelector(".top-aprogress");l&&l.remove();var o=document.querySelector("input[name=\"old\"]");o&&o.focus();});function spinner(){var x=document.querySelector(".fa.fa-unlock"),s =\'<span class="cspinner_container" style="position: absolute; width: 18px; height: 14px; display: inline-block;"><span class="cspinner" style="margin-top: 0; margin-left: -23px;"><span class="cspinner-icon white small"></span></span></span>\';x.classList.add("invisible"); x.insertAdjacentHTML(\'afterend\', s);x.parentNode.classList.add("disabled");x.parentNode.disabled=true}</script>';
print '</div>';
print '</form>' . "\n";
print "$text{'password_postfix'}\n";
&footer();