Merge remote-tracking branch 'mainRepo/master' into feature/VAT_number

This commit is contained in:
PCoder 2019-12-21 08:19:23 +05:30
commit c9de757bc7
19 changed files with 521 additions and 45 deletions

View file

@ -23,7 +23,6 @@
.hosting-dashboard .dashboard-container-head {
color: #fff;
margin-bottom: 60px;
}
.hosting-dashboard-item {

View file

@ -248,6 +248,9 @@
.dashboard-title-thin {
font-size: 22px;
}
.dashboard-greetings-thin {
font-size: 16px;
}
}
.btn-vm-invoice {
@ -315,6 +318,11 @@
font-size: 32px;
}
.dashboard-greetings-thin {
font-weight: 300;
font-size: 24px;
}
.dashboard-title-thin .un-icon {
height: 34px;
margin-right: 5px;
@ -411,6 +419,9 @@
.dashboard-title-thin {
font-size: 22px;
}
.dashboard-greetings-thin {
font-size: 16px;
}
.dashboard-title-thin .un-icon {
height: 22px;
width: 22px;

View file

@ -7,6 +7,9 @@
<div class="dashboard-container-head">
<h1 class="dashboard-title-thin">{% trans "My Dashboard" %}</h1>
</div>
<div style="color:#fff; font-size: 18px; font-weight:300; padding: 0 8px; margin-top: 30px; margin-bottom: 30px;">
{% trans "Welcome" %} {{request.user.name}}
</div>
<div class="hosting-dashboard-content">
<a href="{% url 'hosting:create_virtual_machine' %}" class="hosting-dashboard-item">
<h2>{% trans "Create VM" %}</h2>

View file

@ -26,7 +26,7 @@
</li>
<li class="dropdown highlights-dropdown">
<a class="dropdown-toggle" role="button" data-toggle="dropdown" href="#">
<i class="fa fa-fw fa-user"></i>&nbsp;&nbsp;{{request.user.name}}&nbsp;<span class="fa fa-fw fa-caret-down"></span>
<i class="fa fa-fw fa-user"></i>&nbsp;&nbsp;{{request.user.username}}&nbsp;<span class="fa fa-fw fa-caret-down"></span>
</a>
<ul id="g-account-menu" class="dropdown-menu" role="menu">
<li><a href="{% url 'hosting:logout' %}">{% trans "Logout"%}</a></li>

View file

@ -15,6 +15,10 @@
<div class="settings-container">
<div class="row">
<div class="col-sm-5 col-md-6 billing dcl-billing">
<h3><b>{%trans "My Username"%}</b></h3>
<hr class="top-hr">
<p>{{request.user.username}}</p>
<br>
<h3>{%trans "Billing Address" %}</h3>
<hr>
<form role="form" id="billing-form" method="post" action="" novalidate>

View file

@ -57,6 +57,8 @@ from utils.hosting_utils import (
from utils.mailer import BaseEmail
from utils.stripe_utils import StripeUtils
from utils.tasks import send_plain_email_task
from utils.ldap_manager import LdapManager
from utils.views import (
PasswordResetViewMixin, PasswordResetConfirmViewMixin, LoginViewMixin,
ResendActivationLinkViewMixin
@ -394,21 +396,30 @@ class PasswordResetConfirmView(HostingContextMixin,
if user is not None and default_token_generator.check_token(user,
token):
if form.is_valid():
ldap_manager = LdapManager()
new_password = form.cleaned_data['new_password2']
user.set_password(new_password)
user.save()
messages.success(request, _('Password has been reset.'))
# Change opennebula password
opennebula_client.change_user_password(user.password)
# Make sure the user have an ldap account already
user.create_ldap_account(new_password)
return self.form_valid(form)
else:
messages.error(
request, _('Password reset has not been successful.'))
form.add_error(None,
_('Password reset has not been successful.'))
return self.form_invalid(form)
# We are changing password in ldap before changing in database because
# ldap have more chances of failure than local database
if ldap_manager.change_password(user.username, new_password):
user.set_password(new_password)
user.save()
messages.success(request, _('Password has been reset.'))
# Change opennebula password
opennebula_client.change_user_password(user.password)
return self.form_valid(form)
messages.error(
request, _('Password reset has not been successful.'))
form.add_error(None,
_('Password reset has not been successful.'))
return self.form_invalid(form)
else:
error_msg = _('The reset password link is no longer valid.')