Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added BugHunt Logic, Various Design Changes #670

Merged
merged 35 commits into from
Aug 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
be6c789
Updated the packages to current version
srahulbadami May 25, 2020
88a932f
Removed whitenoise nonstatic for debug mode
srahulbadami May 25, 2020
965c742
Merge branch 'master' of https://github.com/OWASP/BLT into UpdatedPac…
srahulbadami May 25, 2020
d1c93f4
Removed whitenoise nonstatic for debug mode
srahulbadami May 25, 2020
ef490a8
Changed templates w.r.t new design
srahulbadami Jun 2, 2020
710252d
Merge branch 'master' of https://github.com/OWASP/BLT into Develop_20.05
srahulbadami Jun 3, 2020
ed65685
Merge pull request #655 from srahulbadami/Develop_20.05
souravbadami Jun 3, 2020
ac12a75
Added Dashboard Template & Changed Models
srahulbadami Jun 13, 2020
7e8ad63
Added User Dashboard
srahulbadami Jun 13, 2020
11dff1d
Added More Dashboard Functionalities
srahulbadami Jun 13, 2020
e2962d9
Minor Changes
srahulbadami Jun 13, 2020
5418202
Added Admin Role Changed Functionalites to Dashbord
srahulbadami Jun 14, 2020
7fa46b5
Added Bughiest Admin Dashboard
srahulbadami Jun 14, 2020
0df477f
Minor Changes
srahulbadami Jun 14, 2020
3043221
Merge pull request #658 from srahulbadami/Develop_20.05
souravbadami Jun 19, 2020
7cf82c4
Added Create Hunt Templates
srahulbadami Jun 21, 2020
48531df
Create Hunt Features
srahulbadami Jun 21, 2020
dc11537
Merge branch 'develop' of https://github.com/OWASP/BLT into Develop_2…
srahulbadami Jun 21, 2020
a81737f
Merge pull request #659 from srahulbadami/Develop_20.05
souravbadami Jun 21, 2020
cf93455
TimeZone Fixes
srahulbadami Jun 28, 2020
ca05caf
Merge pull request #661 from srahulbadami/Develop_20.05
souravbadami Jun 30, 2020
eb0b0b7
fixing merge conflicts
fredfalcon Jul 1, 2020
8456732
Merge branch 'master' into develop
fredfalcon Jul 1, 2020
0d5a015
Added Banner Image, Changed Footer, Fixed CSS Issues
srahulbadami Jul 12, 2020
c69187c
Merge branch 'develop' of https://github.com/OWASP/BLT into Develop_2…
srahulbadami Jul 12, 2020
e7695b5
Merge pull request #667 from srahulbadami/Develop_20.05
souravbadami Jul 12, 2020
6ca27c0
Search Page Minor Changes
srahulbadami Jul 13, 2020
3b701cc
Merge branch 'Develop_20.05' of https://github.com/srahulbadami/BLT i…
srahulbadami Jul 13, 2020
7b33764
Added Scores to Search Results
srahulbadami Jul 13, 2020
5f9b1fa
Added Profile Page to Dashboard
srahulbadami Jul 19, 2020
32ead42
Home Page Changes as per New Designs
srahulbadami Jul 25, 2020
3a9a624
Added New Elements
srahulbadami Jul 26, 2020
f41540a
Improved Search Page Design
srahulbadami Jul 26, 2020
c2c3a0b
Fixed Home Page Bug Report, Changed Header, Changed Leaderboard Header
srahulbadami Aug 8, 2020
b80e739
Changed Profile Page
srahulbadami Aug 9, 2020
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
4 changes: 4 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ ua-parser = "*"
djangorestframework = "*"
django_filter = "*"
cffi = "*"
django-mdeditor = "*"
django-tz-detect = "*"
django-tellme = "*"
django-bootstrap-datepicker-plus = "*"
django-star-ratings = "*"

[dev-packages]

Expand Down
204 changes: 132 additions & 72 deletions Pipfile.lock

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions bugheist/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@
'django_filters',
'rest_framework.authtoken',
'django_cron',
'mdeditor',
'bootstrap_datepicker_plus',
'tz_detect',
'tellme',
'star_ratings',
)

CRON_CLASSES = [
Expand All @@ -81,6 +85,7 @@
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'tz_detect.middleware.TimezoneMiddleware',
)

TESTING = len(sys.argv) > 1 and sys.argv[1] == 'test'
Expand Down Expand Up @@ -349,3 +354,13 @@
),
'PAGE_SIZE': 10
}

X_FRAME_OPTIONS = 'SAMEORIGIN'

MDEDITOR_CONFIGS = {
'default': {
'language': 'en',
'toolbar': ["undo", "redo", "|","bold", "del", "italic", "quote", "ucwords", "uppercase", "lowercase", "|","h1", "h2", "h3", "h5", "h6", "|","list-ul", "list-ol", "hr", "|", "link", "reference-link", "code", "code-block", "table", "datetime", "||", "preview", "fullscreen"],
'watch' : False
}
}
28 changes: 27 additions & 1 deletion bugheist/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
from website.views import (UserProfileDetailView, IssueCreate, UploadCreate, EmailDetailView,
InboundParseWebhookView, LeaderboardView, IssueView, AllIssuesView, SpecificIssuesView,
HuntCreate, DomainDetailView, StatsDetailView, InviteCreate, CreateInviteFriend,
ScoreboardView,get_score,CustomObtainAuthToken,create_tokens,issue_count,get_scoreboard)
ScoreboardView,get_score,CustomObtainAuthToken,create_tokens,issue_count,get_scoreboard,
CreateHunt, DraftHunts, UpcomingHunts, CompanySettings, OngoingHunts, PreviousHunts,
DomainList, UserProfileDetailsView )
from rest_framework.authtoken import views

favicon_view = RedirectView.as_view(url='/static/favicon.ico', permanent=True)
Expand All @@ -23,6 +25,27 @@

urlpatterns = [
url(r'^$', website.views.index, name='index'),
url(r'^dashboard/company/$', website.views.company_dashboard, name='company_dashboar_home'),
url(r'^dashboard/admin$', website.views.admin_dashboard, name='admin_dashboard'),
url(r'^dashboard/admin/company$', website.views.admin_company_dashboard, name='admin_company_dashboard'),
url(r'^dashboard/admin/company/addorupdate$', website.views.add_or_update_company, name='add_or_update_company'),
url(r'^dashboard/company/domain/addorupdate$', website.views.add_or_update_domain, name='add_or_update_domain'),
path('dashboard/company/domain/<int:pk>/', website.views.company_dashboard_domain_detail, name='company_dashboard_domain_detail'),
path('dashboard/company/hunt/<int:pk>/', website.views.company_dashboard_hunt_detail, name='company_dashboard_hunt_detail'),
path('dashboard/company/hunt/<int:pk>/edit', website.views.company_dashboard_hunt_edit, name='company_dashboard_hunt_edit'),
path('dashboard/admin/company/<int:pk>/', website.views.admin_company_dashboard_detail, name='admin_company_dashboard_detail'),
url(r'^dashboard/company/hunt/create$', CreateHunt.as_view(), name='create_hunt'),
url(r'^dashboard/company/hunt/drafts$', DraftHunts.as_view(), name='draft_hunts'),
url(r'^dashboard/company/hunt/upcoming$', UpcomingHunts.as_view(), name='upcoming_hunts'),
url(r'^dashboard/company/hunt/previous$', PreviousHunts.as_view(), name='previous_hunts'),
url(r'^dashboard/company/hunt/ongoing$', OngoingHunts.as_view(), name='ongoing_hunts'),
url(r'^dashboard/company/domains$', DomainList.as_view(), name='domain_list'),
url(r'^dashboard/company/settings$', CompanySettings.as_view(), name='company-settings'),
url(r'^dashboard/company/settings/role/update$', website.views.update_role, name='update-role'),
url(r'^dashboard/company/settings/role/add$', website.views.add_role, name='add-role'),
url(r'^dashboard/user/$', website.views.user_dashboard, name='user'),
url(r'^dashboard/user/profile/(?P<slug>[^/]+)/$',
UserProfileDetailsView.as_view(), name="user_profile"),
path(settings.ADMIN_URL + '/', admin.site.urls),
url(r'^like_issue/(?P<issue_pk>\d+)/$', website.views.like_issue, name="like_issue"),
url(r'^save_issue/(?P<issue_pk>\d+)/$', website.views.save_issue, name="save_issue"),
Expand Down Expand Up @@ -84,7 +107,10 @@
url(r'^api/v1/issue/update/$', csrf_exempt(website.views.UpdateIssue)),
url(r'^api/v1/scoreboard/$', website.views.get_scoreboard),
url(r'^error/', website.views.throw_error, name='post_error'),
url(r'^tz_detect/', include('tz_detect.urls')),
url(r'^tellme/', include("tellme.urls")),
url(r'^ratings/', include('star_ratings.urls',namespace='ratings')),

]

if settings.DEBUG:
Expand Down
43 changes: 38 additions & 5 deletions website/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from import_export import resources
from import_export.admin import ImportExportModelAdmin

from website.models import Issue, Points, Hunt, Domain, UserProfile
from website.models import Issue, Points, Hunt, Domain, UserProfile, Subscription, CompanyAdmin, Company


class UserResource(resources.ModelResource):
Expand All @@ -16,20 +16,48 @@ class DomainResource(resources.ModelResource):
class Meta:
model = Domain

class SubscriptionResource(resources.ModelResource):
class Meta:
model = Subscription

class CompanyAdminResource(resources.ModelResource):
class Meta:
model = CompanyAdmin

class CompanyResource(resources.ModelResource):
class Meta:
model = Company


class IssueAdmin(admin.ModelAdmin):
list_display = (
'id', 'user', 'url', 'domain', 'description', 'closed_by', 'closed_date', 'screenshot', 'created', 'modified')


class HuntAdmin(admin.ModelAdmin):
list_display = ('user', 'url', 'prize', 'logo', 'plan', 'created', 'modified')
list_display = ('domain', 'url', 'prize', 'logo', 'starts_on','end_on', 'plan', 'created', 'modified')


class DomainAdmin(ImportExportModelAdmin):
class DomainAdminPanel(ImportExportModelAdmin):
resource_class = DomainResource
list_display = (
'name', 'url', 'logo', 'clicks', 'color', 'email', 'email_event', 'twitter', 'facebook', 'created', 'modified')
'name', 'company', 'url', 'logo', 'clicks', 'color', 'email', 'email_event', 'twitter', 'facebook', 'created', 'modified')

class CompanyUserAdmin(ImportExportModelAdmin):
resource_class = CompanyAdminResource
list_display = (
'role', 'user', 'company', 'domain', 'is_active')

class SubscriptionAdmin(ImportExportModelAdmin):
resource_class = SubscriptionResource
list_display = (
'name', 'charge_per_month', 'hunt_per_domain', 'number_of_domains', 'feature')


class CompanyAdmins(ImportExportModelAdmin):
resource_class = CompanyResource
list_display = (
'admin', 'name', 'url', 'email', 'twitter', 'facebook', 'created', 'modified', 'subscription')


class PointsAdmin(admin.ModelAdmin):
Expand All @@ -50,8 +78,13 @@ class UserAdmin(ImportExportModelAdmin):
admin.site.register(UserProfile)
admin.site.register(User, UserAdmin)

admin.site.register(Domain, DomainAdmin)
admin.site.register(Domain, DomainAdminPanel)

admin.site.register(Issue, IssueAdmin)
admin.site.register(Points, PointsAdmin)
admin.site.register(Hunt, HuntAdmin)

admin.site.register(CompanyAdmin, CompanyUserAdmin)
admin.site.register(Company, CompanyAdmins)

admin.site.register(Subscription, SubscriptionAdmin)
9 changes: 8 additions & 1 deletion website/forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from django import forms

from .models import InviteFriend, UserProfile
from .models import InviteFriend, UserProfile, Hunt
from mdeditor.fields import MDTextFormField
from bootstrap_datepicker_plus import DateTimePickerInput


class FormInviteFriend(forms.ModelForm):
Expand All @@ -14,3 +16,8 @@ class UserProfileForm(forms.ModelForm):
class Meta:
model = UserProfile
fields = ('user_avatar',)

class HuntForm (forms.Form):
content = MDTextFormField ()
start_date = forms.DateTimeField(widget=forms.DateTimeInput(attrs={'class': 'col-sm-6', 'readonly' : True}),label='', required=False )
end_date = forms.DateTimeField(widget=forms.DateTimeInput(attrs={'class': 'col-sm-6', 'readonly' : True}),label='', required=False)
59 changes: 59 additions & 0 deletions website/migrations/0047_auto_20200613_0814.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Generated by Django 3.0.7 on 2020-06-13 08:14

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('website', '0046_auto_20180630_0848'),
]

operations = [
migrations.CreateModel(
name='Subscription',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(blank=True, max_length=25)),
('charge_per_month', models.IntegerField(blank=True)),
('feature', models.BooleanField(default=True)),
],
),
migrations.RemoveField(
model_name='hunt',
name='user',
),
migrations.AddField(
model_name='domain',
name='admin',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='domain',
name='is_published',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='hunt',
name='domain',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='website.Domain'),
preserve_default=False,
),
migrations.CreateModel(
name='DomainAdmin',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('is_active', models.BooleanField(default=True)),
('domain', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='website.Domain')),
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.AddField(
model_name='domain',
name='subscription',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='website.Subscription'),
),
]
18 changes: 18 additions & 0 deletions website/migrations/0048_domainadmin_role.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.0.7 on 2020-06-13 08:22

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('website', '0047_auto_20200613_0814'),
]

operations = [
migrations.AddField(
model_name='domainadmin',
name='role',
field=models.IntegerField(choices=[(0, 'Super Admin'), (1, 'Hunt Admin')], default=0),
),
]
22 changes: 22 additions & 0 deletions website/migrations/0049_auto_20200613_1429.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 3.0.7 on 2020-06-13 14:29

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('website', '0048_domainadmin_role'),
]

operations = [
migrations.RemoveField(
model_name='domain',
name='is_published',
),
migrations.AddField(
model_name='hunt',
name='is_published',
field=models.BooleanField(default=False),
),
]
26 changes: 26 additions & 0 deletions website/migrations/0050_auto_20200613_1512.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 3.0.7 on 2020-06-13 15:12

from django.db import migrations, models
import django.utils.timezone


class Migration(migrations.Migration):

dependencies = [
('website', '0049_auto_20200613_1429'),
]

operations = [
migrations.AddField(
model_name='hunt',
name='end_on',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
preserve_default=False,
),
migrations.AddField(
model_name='hunt',
name='starts_on',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
preserve_default=False,
),
]
23 changes: 23 additions & 0 deletions website/migrations/0051_auto_20200613_1515.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.0.7 on 2020-06-13 15:15

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('website', '0050_auto_20200613_1512'),
]

operations = [
migrations.AlterField(
model_name='hunt',
name='end_on',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AlterField(
model_name='hunt',
name='starts_on',
field=models.DateTimeField(blank=True, null=True),
),
]
Loading