Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ webvirtcloud/settings.py
.coverage
htmlcov
*.log
templates/webvirtcloud.code-workspace
12 changes: 6 additions & 6 deletions accounts/templates/account.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base.html" %}

{% load i18n %}
{% load icons %}
{% load bootstrap_icons %}
{% load qr_code %}

{% block title %}{% trans "User Profile" %} - {{ user }}{% endblock %}
Expand All @@ -10,14 +10,14 @@
{% block page_heading_extra %}
{% if otp_enabled %}
<a href="{% url 'accounts:admin_email_otp' user.id %}" class="btn btn-secondary" title="{% trans "Email OTP QR code" %}">
{% icon 'qrcode' %}
{% bs_icon 'qr-code' %}
</a>
{% endif %}
<a href="{% url 'admin:user_update' user.id %}?next={% url 'accounts:account' user.id %}" class="btn btn-primary" title="{% trans "Edit user" %}">
{% icon 'pencil' %}
{% bs_icon 'pencil' %}
</a>
<a href="{% url 'accounts:user_instance_create' user.id %}" class="btn btn-success" title="{% trans "Create user instance" %}">
{% icon 'plus' %}
{% bs_icon 'plus-circle-fill' %}
</a>
{% endblock page_heading_extra %}

Expand Down Expand Up @@ -58,12 +58,12 @@
<td>{{ inst.is_delete }}</td>
<td style="width:5px;">
<a href="{% url 'accounts:user_instance_update' inst.id %}" class="btn btn-sm btn-secondary" title="{% trans "edit" %}">
{% icon 'pencil' %}
{% bs_icon 'pencil' %}
</a>
</td>
<td style="width:5px;">
<a class="btn btn-sm btn-secondary" href="{% url 'accounts:user_instance_delete' inst.id %}" title="{% trans "Delete" %}">
{% icon 'trash' %}
{% bs_icon 'trash' %}
</a>
</td>
</tr>
Expand Down
6 changes: 3 additions & 3 deletions accounts/templates/accounts/change_password_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% load django_bootstrap5 %}
{% load i18n %}
{% load icons %}
{% load bootstrap_icons %}

{% block title %}{%trans "Change Password" %}{% endblock title %}

Expand All @@ -21,10 +21,10 @@ <h4 class="card-title">{%trans "Change Password" %}: {{ user }}</h4>
</div>
<div class="card-footer">
<div class="float-end">
<a class="btn btn-primary" href="javascript:history.back()">{% icon 'times' %}
<a class="btn btn-primary" href="javascript:history.back()">{% bs_icon 'x' %}
{% trans "Cancel" %}</a>
<button type="submit" form="password-change" class="btn btn-success">
{% icon 'check' %} {% trans "Change" %}
{% bs_icon 'check2' %} {% trans "Change" %}
</button>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions accounts/templates/accounts/email_otp_form.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base.html" %}
{% load django_bootstrap5 %}
{% load icons %}
{% load bootstrap_icons %}
{% load i18n %}

{% block title %}{{ title }}{% endblock %}
Expand All @@ -22,9 +22,9 @@
</div>
<div class="card-footer">
<div class="mb-0 float-end">
<a class="btn btn-primary" href="javascript:history.back()">{% icon 'arrow-left' %} {% trans "Cancel" %}</a>
<a class="btn btn-primary" href="javascript:history.back()">{% bs_icon 'arrow-left' %} {% trans "Cancel" %}</a>
<button type="submit" form="create-update" class="btn btn-success">
{% icon 'envelope-o' %} {% trans "Send" %}
{% bs_icon 'envelope-open' %} {% trans "Send" %}
</button>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions accounts/templates/profile.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base.html" %}
{% load i18n %}
{% load django_bootstrap5 %}
{% load icons %}
{% load bootstrap_icons %}
{% load tags_fingerprint %}

{% block title %}{% trans "Profile" %}: {{ request.user.first_name }} {{ request.user.last_name}}{% endblock %}
Expand Down Expand Up @@ -30,12 +30,12 @@
{% bootstrap_form profile_form layout='horizontal' %}
{% if perms.accounts.change_password %}
<a href="{% url 'accounts:change_password' %}" class="btn btn-primary">
{% icon 'lock' %} {% trans "Change Password" %}
{% bs_icon 'lock' %} {% trans "Change Password" %}
</a>
{% endif %}
<div class="mb-0 float-end">
<button type="submit" class="btn btn-primary">
{% icon 'pencil' %} {% trans "Update" %}
{% bs_icon 'pencil' %} {% trans "Update" %}
</button>
</div>
</form>
Expand All @@ -53,7 +53,7 @@
<td>{{ key.keyname }} ({% ssh_to_fingerprint key.keypublic %})</td>
<td>
<a href="{% url 'accounts:ssh_key_delete' key.id %}" title="{% trans "Delete" %}" class="btn btn-sm btn-secondary">
{% icon 'trash' %}
{% bs_icon 'trash' %}
</a>
</td>
</tr>
Expand All @@ -73,7 +73,7 @@
{% bootstrap_form ssh_key_form layout='horizontal' %}
<div class="mb-0 float-end">
<button type="submit" class="btn btn-primary">
{% icon 'plus' %} {% trans "Add" %}
{% bs_icon 'plus-circle-fill' %} {% trans "Add" %}
</button>
</div>
</form>
Expand Down
3 changes: 2 additions & 1 deletion accounts/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from django_otp.forms import OTPAuthenticationForm

from . import views
from .views import CustomLoginView

app_name = "accounts"

Expand Down Expand Up @@ -50,5 +51,5 @@
]
else:
urlpatterns += (
path("login/", LoginView.as_view(template_name="login.html"), name="login"),
path("login/", CustomLoginView.as_view(template_name="login.html"), name="login"),
)
18 changes: 16 additions & 2 deletions accounts/views.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from admin.decorators import superuser_only
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import get_user_model, update_session_auth_hash
from django.contrib.auth import get_user_model, update_session_auth_hash, login as auth_login
from django.contrib.auth.decorators import permission_required
from django.contrib.auth.forms import PasswordChangeForm
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse
from django.http import HttpResponseRedirect
from django.utils.translation import gettext_lazy as _
from instances.models import Instance

Expand All @@ -14,7 +15,20 @@

from . import forms
from .utils import get_user_totp_device, send_email_with_otp

from django.contrib.auth.views import LoginView
from logs.views import addlogmsg

class CustomLoginView(LoginView):
def form_valid(self, form):
username = form.cleaned_data['username']
addlogmsg(username, "-", "-", "Logged In")
auth_login(self.request, form.get_user())
return HttpResponseRedirect(self.get_success_url())

def form_invalid(self, form):
username = form.cleaned_data['username']
addlogmsg(username, "-", "-", "Failed Login Attempt")
return self.render_to_response(self.get_context_data(form=form))

def profile(request):
publickeys = UserSSHKey.objects.filter(user_id=request.user.id)
Expand Down
10 changes: 5 additions & 5 deletions admin/templates/admin/group_list.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{% extends "base.html" %}
{% load i18n %}
{% load static %}
{% load icons %}
{% load bootstrap_icons %}
{% block title %}{% trans "Users" %}{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-12">
<a href="{% url 'admin:group_create' %}" class="btn btn-success btn-header float-end">
{% icon 'plus' %}
{% bs_icon 'plus-circle-fill' %}
</a>
{% include 'search_block.html' %}
<h1 class="page-header">{% trans "Groups" %}</h1>
Expand All @@ -17,7 +17,7 @@ <h1 class="page-header">{% trans "Groups" %}</h1>
{% if not groups %}
<div class="col-lg-12">
<div class="alert alert-warning shadow-sm">
{% icon 'exclamation-triangle '%} <strong>{% trans "Warning" %}:</strong> {% trans "You don't have any groups" %}
{% bs_icon 'exclamation-triangle '%} <strong>{% trans "Warning" %}:</strong> {% trans "You don't have any groups" %}
</div>
</div>
{% else %}
Expand All @@ -38,10 +38,10 @@ <h1 class="page-header">{% trans "Groups" %}</h1>
<td>
<div class="float-end btn-group">
<a class="btn btn-primary" href="{% url 'admin:group_update' group.id %}" title="{%trans "Edit" %}">
{% icon 'pencil' %}
{% bs_icon 'pencil' %}
</a>
<a class="btn btn-danger" href="{% url 'admin:group_delete' group.id %}" title="{%trans "Delete" %}">
{% icon 'times' %}
{% bs_icon 'x' %}
</a>
</div>
</td>
Expand Down
3 changes: 2 additions & 1 deletion admin/templates/admin/logs.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends "base.html" %}
{% load i18n %}
{% load django_bootstrap5 %}
{% load bootstrap_icons %}

{% block title %}{% trans "Logs" %}{% endblock %}

Expand All @@ -18,7 +19,7 @@
{% if not logs %}
<div class="col-lg-12">
<div class="alert alert-warning shadow-sm">
<i class="fa fa-exclamation-triangle"></i> <strong>{% trans "Warning" %}:</strong> {% trans "You don't have any Logs" %}
{% bs_icon 'exclamation-triangle'%} <strong>{% trans "Warning" %}:</strong> {% trans "You don't have any Logs" %}
</div>
</div>
{% else %}
Expand Down
7 changes: 4 additions & 3 deletions admin/templates/admin/user_form.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base.html" %}
{% load django_bootstrap5 %}
{% load icons %}
{% load bootstrap_icons %}
{% load i18n %}

{% block title %}{{ title }}{% endblock %}
Expand All @@ -16,9 +16,10 @@
{% bootstrap_form attributes_form layout='horizontal' %}
</form>
<div class="float-end">
<a class="btn btn-primary" href="javascript:history.back()">{% icon 'times' %} {% trans "Cancel" %}</a>
<a class="btn btn-primary" href="javascript:history.back()">
{% bs_icon 'x-square-fill' %} {% trans "Cancel" %}</a>
<button type="submit" form="create-update" class="btn btn-success">
{% icon 'check' %} {% trans "Save" %}
{% bs_icon 'check2' %} {% trans "Save" %}
</button>
</div>
</div>
Expand Down
22 changes: 11 additions & 11 deletions admin/templates/admin/user_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
{% load i18n %}
{% load static %}
{% load common_tags %}
{% load icons %}
{% load bootstrap_icons %}

{% block title %}{{ title }}{% endblock %}

{% block page_heading %}{{ title }}{% endblock page_heading %}

{% block page_heading_extra %}
<a href="{% url 'admin:user_create' %}" class="btn btn-success btn-header float-end">
{% icon 'plus' %}
{% bs_icon 'plus-circle-fill' %}
</a>
{% include 'search_block.html' %}
{% endblock page_heading_extra %}
Expand All @@ -20,7 +20,7 @@
{% if not users %}
<div class="col-lg-12">
<div class="alert alert-warning shadow-sm">
{% icon 'exclamation-triangle '%} <strong>{% trans "Warning" %}:</strong> {% trans "You don't have any user" %}
{% bs_icon 'exclamation-triangle '%} <strong>{% trans "Warning" %}:</strong> {% trans "You don't have any user" %}
</div>
</div>
{% else %}
Expand Down Expand Up @@ -50,19 +50,19 @@
{% trans "Blocked" %}
{% endif %}
</td>
<td>{% if user.is_staff %}{% icon 'check' %}{% endif %}</td>
<td>{% if user.is_superuser %}{% icon 'check' %}</span>{% endif %}</td>
<td>{% if can_clone %}{% icon 'check' %}{% endif %}</td>
<td>{% if user.is_staff %}{% bs_icon 'check' %}{% endif %}</td>
<td>{% if user.is_superuser %}{% bs_icon 'check' %}</span>{% endif %}</td>
<td>{% if can_clone %}{% bs_icon 'check' %}{% endif %}</td>
<td>
<div class="float-end btn-group">
<a class="btn btn-success" title="{%trans "View Profile" %}" href="{% url 'accounts:account' user.id %}">{% icon 'eye' %}</a>
<a class="btn btn-primary" title="{%trans "Edit" %}" href="{% url 'admin:user_update' user.id %}">{% icon 'pencil' %}</a>
<a class="btn btn-success" title="{%trans "View Profile" %}" href="{% url 'accounts:account' user.id %}">{% bs_icon 'eye-fill' %}</a>
<a class="btn btn-primary" title="{%trans "Edit" %}" href="{% url 'admin:user_update' user.id %}">{% bs_icon 'pencil-fill' %}</a>
{% if user.is_active %}
<a class="btn btn-warning" title="{%trans "Block" %}" href="{% url 'admin:user_block' user.id %}">{% icon 'stop' %}</a>
<a class="btn btn-warning" title="{%trans "Block" %}" href="{% url 'admin:user_block' user.id %}">{% bs_icon 'stop-fill' %}</a>
{% else %}
<a class="btn btn-success" title="{%trans "Unblock" %}" href="{% url 'admin:user_unblock' user.id %}">{% icon 'play' %}</a>
<a class="btn btn-success" title="{%trans "Unblock" %}" href="{% url 'admin:user_unblock' user.id %}">{% bs_icon 'play-fill' %}</a>
{% endif %}
<a class="btn btn-danger" title="{%trans "Delete" %}" href="{% url 'admin:user_delete' user.id %}">{% icon 'times' %}</a>
<a class="btn btn-danger" title="{%trans "Delete" %}" href="{% url 'admin:user_delete' user.id %}">{% bs_icon 'x-circle-fill' %}</a>
</div>
</td>
</tr>
Expand Down
7 changes: 4 additions & 3 deletions computes/templates/computes/form.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base.html" %}
{% load django_bootstrap5 %}
{% load icons %}
{% load bootstrap_icons %}
{% load i18n %}

{% block title %}{% trans "Add Compute" %}{% endblock %}
Expand All @@ -18,9 +18,10 @@ <h2 class="page-header">{% trans "Create Compute" %}</h2>
{% bootstrap_form form layout='horizontal' %}
</form>
<div class="float-end">
<a class="btn btn-primary" href="javascript:history.back()">{% icon 'times' %} {% trans "Cancel" %}</a>
<a class="btn btn-primary" href="javascript:history.back()">
{% bs_icon 'x-square-fill' %} {% trans "Cancel" %}</a>
<button type="submit" form="create-update" class="btn btn-success">
{% icon 'check' %} {% trans "Save" %}
{% bs_icon 'check-circle-fill' %} {% trans "Save" %}
</button>
</div>
</div>
Expand Down
Loading