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
Empty file added oshc/authentication/__init__.py
Empty file.
Empty file added oshc/authentication/admin.py
Empty file.
5 changes: 5 additions & 0 deletions oshc/authentication/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class AuthenticationConfig(AppConfig):
name = 'authentication'
Empty file.
Empty file added oshc/authentication/models.py
Empty file.
24 changes: 24 additions & 0 deletions oshc/authentication/regbackend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from django.contrib.auth import get_user_model


class EmailLoginBackend(object):
'''
This class checks that the user can be authenticated via our backend and if it fails than normal authentication backend is used.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (132 > 79 characters)

'''

def authenticate(self, username=None, password=None):
user_cls = get_user_model()
try:
user = user_cls.objects.get(email=username)
if user.check_password(password):
return user
except user_cls.DoesNotExist:
return None
return None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

def get_user(self, user_id):
user_cls = get_user_model()
try:
return user_cls.objects.get(pk=user_id)
except user_cls.DoesNotExist:
return None
Empty file added oshc/authentication/tests.py
Empty file.
8 changes: 8 additions & 0 deletions oshc/authentication/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.conf.urls import url, include
from . import views

urlpatterns = [
url(r'^accounts/', include('allauth.urls')),
url(r'^accounts/login/profile/', views.profile, name="profile"),
url(r'^ajax/validate_username/$', views.validate_username, name='validate_username'),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (89 > 79 characters)

]
15 changes: 15 additions & 0 deletions oshc/authentication/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from django.shortcuts import render
from django.contrib.auth.models import User
from django.http import JsonResponse


def profile(request):
return render(request, "profile.html")


def validate_username(request):
username = request.GET.get('username', None)
data = {
'is_present': User.objects.filter(username__iexact=username).exists()
}
return JsonResponse(data)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no newline at end of file

27 changes: 2 additions & 25 deletions oshc/main/static/main/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,11 @@ footer .container {
border-top-right-radius: 0;
}

.forgot-password {
.form-registration .forgot-password {
margin-top: 10px;
}

.new-account {
.form-registration .new-account {
display: block;
margin-top: 10px;
}
Expand All @@ -379,26 +379,3 @@ footer .container {
.form-registration button:focus {
background: #0275d8;
}

/*css for strength meter*/

.strength-wrapper {
margin-top: -33px;
}

.strength-wrapper .strength {
float:left;
width:72px;
height:3px;
margin-right: 3px;
}

#passwordStrengthString {
font-size: 0.8em;
margin-left: -299px;
font-weight: bold;
}

.zone {
display:none;
}
Binary file added oshc/main/static/main/images/user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading