Skip to content

Commit

Permalink
Bunch of things. More to do
Browse files Browse the repository at this point in the history
  • Loading branch information
Spencer Romo committed Aug 15, 2016
1 parent a1f43c2 commit 8ec6c20
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 13 deletions.
5 changes: 5 additions & 0 deletions banded/backend.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
from django.contrib.auth.models import User



'''
Custom backend to handle authentication with only email and password.
'''
class EmailAuth:
def authenticate(self, email = '', password = ''):
try:
Expand Down
12 changes: 5 additions & 7 deletions banded/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,11 @@

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
STATIC_URL = "https://%s/static/" % AWS_S3_CUSTOM_DOMAIN
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'



STATIC_URL = '/static/'
STATIC_ROOT = os.path.dirname(BASE_DIR)
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static"),
)



Expand Down
8 changes: 7 additions & 1 deletion banded/views.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
from django.shortcuts import render
from django.template.context import RequestContext



'''
Holders for testing endpoints. This will eventually only be home to the '/'
view.
'''
def home(request):
return render(request, 'home.html')


def loginTest(request):
return render(request, 'login.html')

Expand Down
3 changes: 3 additions & 0 deletions static/css/base.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.test {
font-size: 60px;
}
1 change: 1 addition & 0 deletions static/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<!-- endblock -->
<link rel = 'stylesheet' href = "{% static 'css/base.css' %}">
</head>

<body>
Expand Down
4 changes: 2 additions & 2 deletions static/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
{% if form.errors %}
<p>Error</p>
{% endif %}

<h1 class = 'test'>Boom</h1>
<form action = '/u/auth' method = 'post'>
{% csrf_token %}
<label for = 'email'>
Email:
</label>
<input type = 'text' name = 'email' value = '' id = 'email'>
<input type = 'text' name = 'email' value = '' id = 'email'>
<label for = 'password'>
Password:
</label>
Expand Down
4 changes: 1 addition & 3 deletions users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@

# Create your views here.


#TODO:remove print statements, and properly handle the redirect.
def authorization(request):
try:
em = request.POST.get('email', '')
print 'em: ', em
pw = request.POST.get('password', '')
print 'pw: ', pw
user = authenticate(email = em, password = pw)
if user is not None:
print 'user successfully logged in'
Expand Down

0 comments on commit 8ec6c20

Please sign in to comment.