Fixing some minor email templating issues

* Properly handling the spacing issues in some email templates.
* Adding proper cache values as needed by default templates in action
  so they are set properly, and also work for reapproval.

Change-Id: I3c8f9ffce3618b9a32464efa463c3bbd57782c68
This commit is contained in:
adrian-turjak 2017-05-23 21:36:53 +12:00
parent be1a175dc4
commit f1f0a6d87b
4 changed files with 10 additions and 1 deletions

View File

@ -193,6 +193,8 @@ class NewProjectWithUserAction(UserNameAction, ProjectMixin, UserMixin):
else:
self.action.valid = False
self.action.task.cache['user_state'] = self.action.state
self.action.save()
def _pre_approve(self):
@ -225,6 +227,7 @@ class NewProjectWithUserAction(UserNameAction, ProjectMixin, UserMixin):
roles_granted = self.get_cache('roles_granted')
if user_id and roles_granted:
self.action.task.cache['user_id'] = user_id
self.action.task.cache['user_state'] = self.action.state
self.add_note("User already setup.")
elif not user_id:
self.action.valid = self._validate_user()

View File

@ -3,6 +3,7 @@ You have been invited by {{ task.keystone_user.username }} to join the project '
Please click on this link to accept the invitation:
{{ tokenurl }}{{ token }}
{% spaceless %}
{% if task.cache.user_state == "default" %}
You will be asked to define a password when accepting the invitation. After that you will be given access to the project and will be able to login.
{% elif task.cache.user_state == "existing" %}
@ -10,6 +11,7 @@ As an existing user you will be added to the project and do not need to provide
{% elif task.cache.user_state == "disabled" %}
It appears you already have a user account that was disabled. We've reactivated it, but because it may have been a while we've reset your password. After you setup your new password you will be given access to the project and will be able to login.
{% endif %}
{% endspaceless %}
This link will expire automatically after 24 hours. If expired, you will need to request another one from the person who invited you.

View File

@ -1,3 +1,4 @@
{% spaceless %}
{% if task.cache.user_state == "default" %}
This email is to confirm that your Openstack signup has been completed and your new user and password have now been set up.
{% elif task.cache.user_state == "existing" %}
@ -5,6 +6,7 @@ This email is to confirm that your Openstack signup has been completed and your
{% elif task.cache.user_state == "disabled" %}
This email is to confirm that your Openstack signup has been completed and your existing user has been re-enabled and given access to your new project.
{% endif %}
{% endspaceless %}
If you did not do this yourself, please get in touch with your systems administrator to report suspicious activity and secure your account.

View File

@ -3,11 +3,13 @@ Your OpenStack sign-up has been approved!
Please follow this link to finalise access to your new OpenStack project:
{{ tokenurl }}{{ token }}
{% spaceless %}
{% if task.cache.user_state == "default" %}
You will be asked to define a password, after that you will be given access to the project and will be able to login
{% elif task.cache.user_state == "disabled" %}
It appears you already have a user account that was disabled. We've reactivated it, but because it may have been a while we've reset your password. After you setup your new password you will be given access to your new project and will be able to login.
{% endif %}
{% endspaceless %}
This link expires automatically after 24 hours. If expired, you can simply go to the dashboard and request a password reset.