Skip to content

Commit 580c712

Browse files
Expressionless-Ball-ThingHanyuan Li
and
Hanyuan Li
authored
User routes are up, please check and merge, thanks! (#68)
* feat: moved advent folder -> puzzles, added some comments * feat(docker): start separation of dev and prod builds, add pytest functionality to backend * feat(docker): added dev/prod to frontend, transition frontend to yarn * fix: remove .vscode folder * fix(makefile): restructured makefile a bit * feat: removed .vscode folder from git * feat(auth): get rudimentary autotesting in place, created clear_database function * feat(test): added all tests for auth/register * fix(puzzle): changed blueprint in routes/puzzle.py * Made some stub code for the user routes Made some stub code for the user routes. * Stub codes * feat(auth): refactored registration system, database connections * fix(auth): minor changes to constructor * feat(auth): implement email verification endpoints * feat(test): using fixtures * feat(auth): finish autotests, still needs commenting * feat(auth): finished writing tests for the most part * Merged stuff * user/stats should be working * node stuff * fixed up some stuff about node * profile, stat and set_name implemented * merged * fixed a problem about tokens * improved tests, stub code for password reset * manual overhaul, weird stuff happening with email * All routes going smoothly Co-authored-by: Hanyuan Li <[email protected]>
1 parent 22d3ac4 commit 580c712

20 files changed

+653
-223
lines changed

Pipfile.lock

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/Pipfile.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/app.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ def create_app(config={}):
7676

7777
if __name__ == "__main__":
7878
app = create_app()
79-
app.run(host="0.0.0.0", port=5001)
79+
app.run(host="0.0.0.0", port=5001)

backend/auth/user.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,4 @@ def get(id):
141141
cursor.close()
142142
conn.close()
143143

144-
return User(email, password, id)
144+
return User(email, password, id)

backend/common/database.py

+19-2
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,25 @@ def getAllCompetitions():
221221
def updateUsername(username, uid):
222222
query = f"""
223223
update Users
224-
set username = {username}
224+
set username = '{username}'
225+
where uid = {uid};
226+
"""
227+
cur.execute(query)
228+
conn.commit()
229+
230+
def updateEmail(email, uid):
231+
query = f"""
232+
update Users
233+
set email = '{email}'
234+
where uid = {uid};
235+
"""
236+
cur.execute(query)
237+
conn.commit()
238+
239+
def updatePassword(password, uid):
240+
query = f"""
241+
update Users
242+
set password = '{password}'
225243
where uid = {uid};
226244
"""
227245
cur.execute(query)
@@ -396,4 +414,3 @@ def add_user_with_uid(uid, email, username, password):
396414
"""
397415
cur.execute(query)
398416
conn.commit()
399-

backend/common/exceptions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ class AccessError(Forbidden):
1616
pass
1717

1818
class InvalidError(InternalServerError):
19-
pass
19+
pass

backend/common/redis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ def is_blocked(id):
7171
## GENERAL FUNCTIONS
7272

7373
def clear_redis():
74-
cache.flushdb()
74+
cache.flushdb()

backend/models/user.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@ def get(id):
107107

108108
id, email, github_username, username, password = result
109109

110-
return User(id, email, username, password, github_username)
110+
return User(id, email, username, password, github_username)

backend/routes/auth.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,4 @@ def logout():
102102
@auth.route("/protected", methods=["POST"])
103103
def protected():
104104
verify_jwt_in_request()
105-
return jsonify({}), 200
105+
return jsonify({}), 200

0 commit comments

Comments
 (0)