-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Eduardo
committed
Feb 3, 2014
0 parents
commit c6d713e
Showing
478 changed files
with
85,824 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
*.pyc | ||
django_app/Procfile | ||
django_app/project/settings_prod.py | ||
nodejs_app/Procfile | ||
.settings/ | ||
.project | ||
.pydevproject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Dyapos - A tool for creating beautiful HTML5+CSS3 presentations based on Impress.js. | ||
|
||
Copyright (c) 2013 Edwardoyarzun | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Dyapos | ||
|
||
## Test Dyapos here: [dyapos.heroku.com](http://dyapos.heroku.com) | ||
|
||
# License | ||
|
||
Copyright (c) 2013 Edwardoyarzun | ||
|
||
Released under the GPL License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.pyc | ||
venv |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from django.contrib.auth.models import User, check_password | ||
|
||
class EmailAuthBackend(object): | ||
""" | ||
Email Authentication Backend | ||
Allows a user to sign in using an email/password pair rather than | ||
a username/password pair. | ||
""" | ||
|
||
def authenticate(self, username=None, password=None): | ||
""" Authenticate a user based on email address as the user name. """ | ||
try: | ||
user = User.objects.get(email=username) | ||
if user.check_password(password): | ||
return user | ||
except User.DoesNotExist: | ||
return None | ||
|
||
def get_user(self, user_id): | ||
""" Get a User object from the user_id. """ | ||
try: | ||
return User.objects.get(pk=user_id) | ||
except User.DoesNotExist: | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[ | ||
{ | ||
"model": "main.theme", | ||
"pk": 1, | ||
"fields": { | ||
"name": "Default Theme", | ||
"is_custom": 0 | ||
} | ||
}, | ||
{ | ||
"model": "main.theme", | ||
"pk": 2, | ||
"fields": { | ||
"name": "Green Theme", | ||
"is_custom": 0 | ||
} | ||
}, | ||
{ | ||
"model": "main.theme", | ||
"pk": 3, | ||
"fields": { | ||
"name": "Blue Theme", | ||
"is_custom": 0 | ||
} | ||
}, | ||
{ | ||
"model": "main.theme", | ||
"pk": 4, | ||
"fields": { | ||
"name": "Coffee", | ||
"is_custom": 0 | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from main.forms.user import * | ||
from main.forms.presentation import * | ||
from main.forms.comment import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django import forms | ||
|
||
class CommentForm(forms.Form): | ||
presentation_id = forms.IntegerField(widget=forms.HiddenInput) | ||
comment = forms.CharField(widget=forms.Textarea, | ||
max_length=500) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from django import forms | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
class NewPresentationForm(forms.Form): | ||
name = forms.CharField(max_length=20) | ||
description = forms.CharField(required=False, | ||
widget=forms.Textarea, | ||
max_length=200) | ||
is_private = forms.BooleanField(required=False, | ||
label=_("is_private")) | ||
|
||
class RenameForm(forms.Form): | ||
name = forms.CharField(max_length=20) | ||
|
||
class ModifyDescriptionForm(forms.Form): | ||
description = forms.CharField(required=False, | ||
widget=forms.Textarea, | ||
max_length=200) | ||
|
||
class SharePresentationForm(forms.Form): | ||
email = forms.EmailField() | ||
permission = forms.ChoiceField(choices=(("1", _("option_allow_edit")), ("0", _("option_view_only")))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
from django import forms | ||
from django.contrib.auth.models import User | ||
from django.contrib.auth import authenticate | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
class SignupForm(forms.Form): | ||
first_name = forms.CharField(min_length=3, | ||
max_length=20) | ||
last_name = forms.CharField(min_length=3, | ||
max_length=20) | ||
email = forms.EmailField() | ||
password = forms.CharField(widget=forms.PasswordInput) | ||
password_repeat = forms.CharField(widget=forms.PasswordInput) | ||
|
||
def clean(self): | ||
# Check if passwords match | ||
password1 = self.cleaned_data.get('password') | ||
password2 = self.cleaned_data.get('password_repeat') | ||
|
||
if password1 != password2: | ||
raise forms.ValidationError(_("error_passwords_dont_match")) | ||
|
||
# Check if email already exists | ||
if User.objects.filter(email=self.cleaned_data.get("email")).exists(): | ||
raise forms.ValidationError(_("error_email_already_registered")) | ||
|
||
return self.cleaned_data | ||
|
||
class LoginForm(forms.Form): | ||
email = forms.EmailField() | ||
password = forms.CharField(widget=forms.PasswordInput) | ||
|
||
def clean(self): | ||
# Validate authentication | ||
email = self.cleaned_data.get("email") | ||
password = self.cleaned_data.get("password") | ||
if(email and password): | ||
user = authenticate(username=email, password=password) | ||
|
||
'''If email and password are correct, it will return an User object | ||
So if not it will return None''' | ||
if user is None: | ||
raise forms.ValidationError(_("error_user_or_password_incorrect")) | ||
else: | ||
# if user is acive | ||
if not user.is_active: | ||
raise forms.ValidationError(_("error_account_not_activated")) | ||
|
||
return self.cleaned_data | ||
|
||
class RecoverPasswordForm(forms.Form): | ||
email = forms.EmailField() | ||
|
||
def clean(self): | ||
# Check if the email address is associated to an account | ||
email = self.cleaned_data.get("email") | ||
if email: | ||
if not User.objects.filter(email=email).exists(): | ||
raise forms.ValidationError(_("error_email_not_registered")) | ||
|
||
return self.cleaned_data | ||
|
||
class ChangePasswordForm(forms.Form): | ||
old_password = forms.CharField(widget=forms.PasswordInput) | ||
new_password = forms.CharField(widget=forms.PasswordInput) | ||
new_password_repeat = forms.CharField(widget=forms.PasswordInput) | ||
|
||
def clean(self): | ||
# Check if passwords match | ||
new_password1 = self.cleaned_data.get("new_password") | ||
new_password2 = self.cleaned_data.get("new_password_repeat") | ||
|
||
if new_password1 != new_password2: | ||
raise forms.ValidationError(_("error_passwords_dont_match")) | ||
|
||
return self.cleaned_data | ||
|
||
class ProfileForm(forms.Form): | ||
first_name = forms.CharField(max_length=15) | ||
last_name = forms.CharField(max_length=15) | ||
email = forms.EmailField() |
Binary file not shown.
Oops, something went wrong.