vesta-web 1.1.10__py3-none-any.whl → 1.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vesta/__init__.py +20 -15
- vesta/scripts/cli.py +1 -1
- vesta/scripts/initDB.py +26 -24
- {vesta_web-1.1.10.dist-info → vesta_web-1.2.0.dist-info}/METADATA +1 -1
- {vesta_web-1.1.10.dist-info → vesta_web-1.2.0.dist-info}/RECORD +8 -8
- {vesta_web-1.1.10.dist-info → vesta_web-1.2.0.dist-info}/WHEEL +0 -0
- {vesta_web-1.1.10.dist-info → vesta_web-1.2.0.dist-info}/entry_points.txt +0 -0
- {vesta_web-1.1.10.dist-info → vesta_web-1.2.0.dist-info}/licenses/LICENSE.md +0 -0
vesta/__init__.py
CHANGED
|
@@ -101,26 +101,27 @@ class Server(server):
|
|
|
101
101
|
self.sendVerification(user)
|
|
102
102
|
|
|
103
103
|
@server.expose
|
|
104
|
-
def login(self, email, password, parrain=None):
|
|
105
|
-
if
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
104
|
+
def login(self, email=None, password=None, parrain=None):
|
|
105
|
+
if not email or not password:
|
|
106
|
+
return 'please give an email and a password'
|
|
107
|
+
|
|
108
|
+
password = password.encode('utf-8') # converting to bytes array
|
|
109
|
+
account = self.uniauth.getUserCredentials(email)
|
|
110
|
+
# If account exists in accounts table
|
|
111
|
+
if account:
|
|
112
|
+
msg = self.connect(account, password)
|
|
113
113
|
else:
|
|
114
|
-
msg =
|
|
114
|
+
msg = self.register(email, password, parrain)
|
|
115
115
|
|
|
116
116
|
return msg
|
|
117
117
|
|
|
118
118
|
@server.expose
|
|
119
|
-
def changePasswordVerif(self,mail, code, password):
|
|
120
|
-
|
|
121
|
-
if not id
|
|
119
|
+
def changePasswordVerif(self, mail, code, password):
|
|
120
|
+
account = self.uniauth.getSomething("account", mail, "email")
|
|
121
|
+
if not account or not account.get("id"):
|
|
122
122
|
return "no account found for " + mail
|
|
123
123
|
|
|
124
|
+
id = account["id"]
|
|
124
125
|
password = password.encode('utf-8')
|
|
125
126
|
actual = self.uniauth.getSomething("reset_code", id)
|
|
126
127
|
if actual and str(actual["code"]) == code and actual["expiration"] > datetime.datetime.now():
|
|
@@ -152,7 +153,7 @@ class Server(server):
|
|
|
152
153
|
user = self.getUser(verif=True)
|
|
153
154
|
print("user:", user)
|
|
154
155
|
actual = self.uniauth.getSomething("verif_code", user)
|
|
155
|
-
if str(actual["code"]) == code and actual["expiration"] > datetime.datetime.now():
|
|
156
|
+
if actual and str(actual["code"]) == code and actual["expiration"] > datetime.datetime.now():
|
|
156
157
|
self.uniauth.edit("account", user, "verified", True)
|
|
157
158
|
self.createJwt(user, True)
|
|
158
159
|
self.onLogin(user)
|
|
@@ -162,7 +163,11 @@ class Server(server):
|
|
|
162
163
|
|
|
163
164
|
@server.expose
|
|
164
165
|
def logout(self):
|
|
165
|
-
|
|
166
|
+
try:
|
|
167
|
+
token = self.getJWT()
|
|
168
|
+
except:
|
|
169
|
+
pass # Cookie doesn't exist, that's fine
|
|
170
|
+
|
|
166
171
|
self.response.del_cookie('JWT')
|
|
167
172
|
self.response.del_cookie('auth')
|
|
168
173
|
raise HTTPRedirect(self.response, "/auth")
|
vesta/scripts/cli.py
CHANGED
|
@@ -2,6 +2,7 @@ import argparse
|
|
|
2
2
|
import os
|
|
3
3
|
import subprocess
|
|
4
4
|
from .utils import ex, Installer
|
|
5
|
+
from .initDB import DBInitializer
|
|
5
6
|
|
|
6
7
|
HERE = os.path.dirname(__file__)
|
|
7
8
|
PATH = os.getcwd()
|
|
@@ -191,7 +192,6 @@ def main():
|
|
|
191
192
|
service_subparsers = parser_service.add_subparsers(dest='service_command')
|
|
192
193
|
parser_service_setup = service_subparsers.add_parser('setup', help='Install systemd config')
|
|
193
194
|
|
|
194
|
-
|
|
195
195
|
args = parser.parse_args()
|
|
196
196
|
|
|
197
197
|
if args.command == 'init':
|
vesta/scripts/initDB.py
CHANGED
|
@@ -18,27 +18,29 @@ class DBInitializer(Server):
|
|
|
18
18
|
|
|
19
19
|
def referenceUniauth(self):
|
|
20
20
|
self.db.cur.execute("CREATE EXTENSION if not exists postgres_fdw;")
|
|
21
|
-
self.db.cur.execute(
|
|
22
|
-
sql.SQL("""
|
|
23
|
-
CREATE SERVER if not exists uniauth
|
|
24
|
-
FOREIGN DATA WRAPPER postgres_fdw
|
|
25
|
-
OPTIONS (host %s, port %s, dbname %s);
|
|
26
|
-
"""),
|
|
27
|
-
(
|
|
28
|
-
self.config.get('UNIAUTH', 'DB_HOST'),
|
|
29
|
-
self.config.get('UNIAUTH', 'DB_PORT'),
|
|
30
|
-
self.config.get('UNIAUTH', 'DB_NAME')
|
|
31
|
-
))
|
|
32
21
|
|
|
33
|
-
self.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
)
|
|
22
|
+
ua_host = self.config.get('UNIAUTH', 'DB_HOST')
|
|
23
|
+
ua_port = self.config.get('UNIAUTH', 'DB_PORT')
|
|
24
|
+
ua_dbname = self.config.get('UNIAUTH', 'DB_NAME')
|
|
25
|
+
q_server = sql.SQL("""
|
|
26
|
+
CREATE SERVER IF NOT EXISTS uniauth
|
|
27
|
+
FOREIGN DATA WRAPPER postgres_fdw
|
|
28
|
+
OPTIONS (host {host}, port {port}, dbname {dbname});
|
|
29
|
+
""").format(
|
|
30
|
+
host=sql.Literal(ua_host),
|
|
31
|
+
port=sql.Literal(ua_port),
|
|
32
|
+
dbname=sql.Literal(ua_dbname)
|
|
33
|
+
)
|
|
34
|
+
self.db.cur.execute(q_server)
|
|
35
|
+
|
|
36
|
+
q_mapping = sql.SQL("""
|
|
37
|
+
CREATE USER MAPPING IF NOT EXISTS FOR CURRENT_USER SERVER uniauth
|
|
38
|
+
OPTIONS (user {user}, password {password});
|
|
39
|
+
""").format(
|
|
40
|
+
user=sql.Literal(self.config.get('DB', 'DB_USER')),
|
|
41
|
+
password=sql.Literal(self.config.get('DB', 'DB_PASSWORD'))
|
|
42
|
+
)
|
|
43
|
+
self.db.cur.execute(q_mapping)
|
|
42
44
|
self.db.cur.execute(
|
|
43
45
|
"""
|
|
44
46
|
CREATE FOREIGN TABLE if not exists account (id bigserial NOT NULL)
|
|
@@ -48,7 +50,7 @@ class DBInitializer(Server):
|
|
|
48
50
|
|
|
49
51
|
|
|
50
52
|
|
|
51
|
-
initializer = DBInitializer(path=PATH[:-3], configFile="/server.ini", noStart=True)
|
|
52
|
-
initializer.initUniauth()
|
|
53
|
-
initializer.initDB()
|
|
54
|
-
print("DB ready")
|
|
53
|
+
# initializer = DBInitializer(path=PATH[:-3], configFile="/server.ini", noStart=True)
|
|
54
|
+
# initializer.initUniauth()
|
|
55
|
+
# initializer.initDB()
|
|
56
|
+
# print("DB ready")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vesta-web
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: An extensive web framework adding every feature needed for Carbonlab
|
|
5
5
|
Project-URL: Homepage, https://gitlab.com/Louciole/vesta
|
|
6
6
|
Project-URL: Issues, https://gitlab.com/Louciole/vesta/-/issues
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
vesta/__init__.py,sha256=
|
|
1
|
+
vesta/__init__.py,sha256=nK5NpQ_E9DbuhuoDNJsUdKdLVQ3PFK2Ou1fepo-92Q0,18106
|
|
2
2
|
vesta/db/UNIAUTH.sql,sha256=3R8Si3rcXfRFC5idmaKTixDWXMazXQzdC9u1BCPCovY,2126
|
|
3
3
|
vesta/db/db_service.py,sha256=E2r6LxxycMOBtpUXWbVIge_363QUCOIJg-MK-Z5dzmw,10058
|
|
4
4
|
vesta/emptyProject/.gitignore,sha256=9ImxEbKZYcw6fZv2coknCwBdmfY7xWkrOgfBWR03VG0,206
|
|
@@ -50,13 +50,13 @@ vesta/http/error.py,sha256=fWdp-oI2ObJD2mHHuxs1yVJvhON5oHYgYFRLAcUMs-I,180
|
|
|
50
50
|
vesta/http/redirect.py,sha256=OiDeOmU-X5Mos8a0BQIeOIJqvgWjDEtaYrM4-x4MXl0,177
|
|
51
51
|
vesta/http/response.py,sha256=G7cmbrXFNbIbQoqNxNkR06I5VymIwjFSAe3LtVa56Ok,3760
|
|
52
52
|
vesta/mailing/mailing_service.py,sha256=GBO5Hnspm9Pqwd5kGB0iekZaMoIrfQvrhMUf8tVma7g,5386
|
|
53
|
-
vesta/scripts/cli.py,sha256=
|
|
54
|
-
vesta/scripts/initDB.py,sha256=
|
|
53
|
+
vesta/scripts/cli.py,sha256=8IHmL09-kzdp-FdqyFlO6cmgYKX5UcpdXdjQDXJpzHs,8257
|
|
54
|
+
vesta/scripts/initDB.py,sha256=4o_J3IK0vcil2oHvk_qmtqLSlWABcRPFBC3M61-oSF8,1842
|
|
55
55
|
vesta/scripts/install.py,sha256=GvH_HHx5aU5_54RQ1_2vz4DaLCh42AHfUKy-m0q21vY,2125
|
|
56
56
|
vesta/scripts/testsRun.py,sha256=bXJImdexKQUDW8CR8F9VIKTrgkd7QfnvHQPENEV4x38,2463
|
|
57
57
|
vesta/scripts/utils.py,sha256=PR2XPonaoZEbegzV3QX1EHfyq67sU-cbDEUexCuJp9Q,6013
|
|
58
|
-
vesta_web-1.
|
|
59
|
-
vesta_web-1.
|
|
60
|
-
vesta_web-1.
|
|
61
|
-
vesta_web-1.
|
|
62
|
-
vesta_web-1.
|
|
58
|
+
vesta_web-1.2.0.dist-info/METADATA,sha256=-Y1fT4y1JvrNFro0-AnUig48F5cAru500JpWkdsUy-0,1584
|
|
59
|
+
vesta_web-1.2.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
60
|
+
vesta_web-1.2.0.dist-info/entry_points.txt,sha256=MHMrWJwtkb4FmNz0CTpxZzwQ3LTqndXBh8YBPDfXlW4,49
|
|
61
|
+
vesta_web-1.2.0.dist-info/licenses/LICENSE.md,sha256=zoPFEFUUoSgosmDBK5fGTWGRHHBaSVuuJT2ZQIYXuIk,177
|
|
62
|
+
vesta_web-1.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|