diff --git a/app.py b/app.py index 123c2c0..a265442 100644 --- a/app.py +++ b/app.py @@ -79,7 +79,7 @@ class Paragraph(db.Model): return self.time.strftime("%m-%d %H:%M") def reaction_status(self): - user = session.get('username') + user = session['uid'] return list(zip( '👍😡🤣😅👎', [self.like_num, self.angry_num, self.fun_num, self.sweat_num, 0], @@ -95,7 +95,7 @@ class Reaction(db.Model): id = db.Column(db.Integer, primary_key=True) kind = db.Column(db.SmallInteger) # 1: like 2: angry 3: funny 4: sweat 5:dislike pid = db.Column(db.Integer, index=True) # id of paragraph - user = db.Column(db.String(30)) # username of user + user = db.Column(db.String(30)) # str(uid) def choose_new_next(min_like_num=MIN_LIKE_NUM): @@ -291,7 +291,6 @@ def create(): @bp.route('/react', methods=['POST']) -@login_required @limiter.limit("100 / minute") def react(): kind = request.form.get('kind', type=int) @@ -300,7 +299,7 @@ def react(): abort(422) p = Paragraph.query.get_or_404(pid) - d = dict(kind=kind, user=session['username'], pid=pid) + d = dict(kind=kind, user=session['uid'], pid=pid) if Reaction.query.filter_by(**d).first(): return '' db.session.add(Reaction(**d)) diff --git a/templates/story.html b/templates/story.html index e5d3553..75ae4bb 100644 --- a/templates/story.html +++ b/templates/story.html @@ -184,8 +184,6 @@