-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathforms.py
More file actions
54 lines (45 loc) · 1.55 KB
/
Copy pathforms.py
File metadata and controls
54 lines (45 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from flask.ext.wtf import Form
from wtforms import TextField, PasswordField
from wtforms.validators import Required
# import config as c
# import psycopg2
"""
import sys,os,os.path
sys.path.append('/usr/local/noi/GIT_EXACT_OGEA/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'ogea.settings'
from django.contrib.auth.models import User
"""
class LoginForm(Form):
username = TextField('username', validators=[Required()])
password = PasswordField('password', validators=[Required()])
"""
def validate(self):
if not(Form.validate(self)):
return -1
try:
user = User.objects.get(username__exact=self.username.data)
if (user.check_password(self.username.password)):
return 1
else:
return -3
except:
return -2
"""
def validate(self):
# Dummy authentication
return 1
# if not(Form.validate(self)):
# return -1
# elif self.username.data == c.username and \
# self.password.data == c.password:
# return 1
"""
class RegForm(Form):
first_name = TextField('first_name', validators = [Required()])
last_name = TextField('last_name', validators = [Required()])
email = EmailField('email', validators = [Required()])
org = TextField('org', validators = [Required()])
username = TextField('username', validators = [Required()])
password = PasswordField('password', validators = [Required()])
password2 = PasswordField('password2', validators = [Required()])
"""