* UI: password are now validated against $c->config->{security}{password}{web_max_age_days} (unless it's 0) and if the password is expired the user is redirected automatically to /changepassword page, and after successful password change back to the original page. * API: if password is expired all API requests will be returning 403 Forbidden "Password expired", except PUT/PATCH to /api/admins or /api/subscribers with the new password in place. * successful login on the UI now redirects to /dashboard instead of / (to prevent unintended redirect to v2) Change-Id: I075f8e17cc9b0658d6b3b3d526ca5b379d050ce4mr13.0
parent
a2a01d4690
commit
b041888807
@ -0,0 +1,52 @@
|
||||
package NGCP::Panel::Form::PasswordChange;
|
||||
|
||||
use HTML::FormHandler::Moose;
|
||||
extends 'HTML::FormHandler';
|
||||
|
||||
use HTML::FormHandler::Widget::Block::Bootstrap;
|
||||
|
||||
has '+widget_wrapper' => ( default => 'Bootstrap' );
|
||||
|
||||
sub build_form_tags {{ error_class => 'label label-secondary'}}
|
||||
|
||||
has_field 'username' => (
|
||||
type => 'Text',
|
||||
required => 1,
|
||||
element_attr => { placeholder => 'Username' },
|
||||
element_class => [qw/login username-field/],
|
||||
wrapper_class => [qw/login-fields field control-group/],
|
||||
);
|
||||
|
||||
has_field 'password' => (
|
||||
type => 'Password',
|
||||
required => 1,
|
||||
element_attr => { placeholder => 'Password' },
|
||||
element_class => [qw/login password-field/],
|
||||
wrapper_class => [qw/login-fields field control-group/],
|
||||
);
|
||||
|
||||
has_field 'new_password' => (
|
||||
type => 'Password',
|
||||
required => 1,
|
||||
element_attr => { placeholder => 'New Password' },
|
||||
element_class => [qw/login password-field/],
|
||||
wrapper_class => [qw/login-fields field control-group/],
|
||||
);
|
||||
|
||||
has_field 'new_password2' => (
|
||||
type => 'Password',
|
||||
required => 1,
|
||||
element_attr => { placeholder => 'New Password Again' },
|
||||
element_class => [qw/login password-field/],
|
||||
wrapper_class => [qw/login-fields field control-group/],
|
||||
);
|
||||
|
||||
has_field 'submit' => (
|
||||
type => 'Submit',
|
||||
value => 'Submit',
|
||||
label => '',
|
||||
element_class => [qw/button btn btn-primary btn-large/],
|
||||
);
|
||||
|
||||
1;
|
||||
# vim: set tabstop=4 expandtab:
|
@ -0,0 +1,69 @@
|
||||
<body class="login" id="change_password_page_v1">
|
||||
<div class="account-container login stacked">
|
||||
|
||||
[% IF messages -%]
|
||||
<div>
|
||||
[% FOREACH m IN messages -%]
|
||||
<div class="alert alert-[% m.type %]">[% m.text %]</div>
|
||||
[% END -%]
|
||||
</div>
|
||||
[% END -%]
|
||||
|
||||
|
||||
<div class="content clearfix">
|
||||
<h1>[% c.loc('Password Change') %]</h1>
|
||||
<p>[% c.loc('Change password using your [_1] credentials:', realm.ucfirst) %]</p>
|
||||
[% form.render %]
|
||||
</div>
|
||||
</div>
|
||||
<div class="login-extra">
|
||||
[% IF realm == 'subscriber' && c.config.security.password_allow_recovery -%]
|
||||
[% c.loc('Forgot your password?') %] <a href="[% c.uri_for_action('/subscriber/reset_webpassword_nosubscriber') %]">[% c.loc('Reset Password') %]</a>.
|
||||
[% ELSIF realm == 'admin' -%]
|
||||
[% c.loc('Forgot your password?') %] <a href="[% c.uri_for_action('/login/reset_password') %]">[% c.loc('Reset Password') %]</a>.
|
||||
[% END -%]
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
<div class="login-footer">
|
||||
[% IF c.config.general.ui_enable && realm != 'subscriber' -%]
|
||||
<div>
|
||||
<b><a href="[% c.uri_for('/') -%]v2/#/login/admin" style="padding-right: 20px">[% c.loc('GO TO NEW ADMIN PANEL') -%]</a></b>
|
||||
</div>
|
||||
[% END -%]
|
||||
</div class="footer">
|
||||
|
||||
<script src="/js/libs/jquery-1.7.2.min.js"></script>
|
||||
<script src="/js/libs/jquery-ui-1.10.3.custom.min.js"></script>
|
||||
<script src="/js/libs/jquery.ui.touch-punch.min.js"></script>
|
||||
<script src="/js/libs/bootstrap/bootstrap.min.js"></script>
|
||||
<script src="/js/Theme.js"></script>
|
||||
<script src="/js/signin.js"></script>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
Theme.init();
|
||||
Object.keys(localStorage).forEach((key)=>{
|
||||
if(!key.startsWith('DataTables_') && !key.startsWith('aui_')){
|
||||
localStorage.removeItem(key);
|
||||
}
|
||||
})
|
||||
localStorage.removeItem('aui_jwt');
|
||||
localStorage.removeItem('aui_adminId');
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
.login-footer {
|
||||
box-sizing: border-box;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
color: white;
|
||||
text-align: right;
|
||||
padding-bottom: 30px;
|
||||
padding-right: 50px;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
[% # vim: set tabstop=4 syntax=html expandtab: -%]
|
Loading…
Reference in new issue