001177e85fe09a3a2fd4c30600a42b92902b3d43,doudizhu/apps/account/views.py,LoginHandler,post,#LoginHandler#,42
Before Change
self.set_header("Content-Type", "application/json")
if password == account.get("password"):
self.set_current_user(account.get("id"), account.get("username"))
self.redirect(self.get_argument("next", "/"))
class LogoutHandler(BaseHandler):
After Change
password = self.get_body_argument("password")
account = await self.db.fetchone("SELECT id, username, password FROM account WHERE email=%s", email)
if not account:
self.send_error(401, reason="This email address does not exist.")
return
verify_pass = await self.run_in_executor(bcrypt.checkpw, password.encode("utf8"),
account.get("password").encode("utf8"))
if not verify_pass:
self.send_error(401, reason="Incorrect username or password.")
uid, username = account.get("id"), account.get("username")
self.set_secure_cookie("user", json_encode({"uid": uid, "username": username}))
token = self.jwt_encode({"uid": uid})
self.write({"token": token, "username": username})
class SignupHandler(RestfulHandler, JwtMixin):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: mailgyc/doudizhu
Commit Name: 001177e85fe09a3a2fd4c30600a42b92902b3d43
Time: 2019-09-30
Author: gaoyc@outlook.com
File Name: doudizhu/apps/account/views.py
Class Name: LoginHandler
Method Name: post
Project Name: sahana/eden
Commit Name: 07f14ce69b1178d6d9dd5787acf23b5f02f3c241
Time: 2019-08-28
Author: fran@aidiq.com
File Name: modules/templates/UCCE/controllers.py
Class Name: dc_TemplateExportL10n
Method Name: apply_method
Project Name: sahana/eden
Commit Name: 0360af501f110f62f0465186d1201826efb40a49
Time: 2018-09-26
Author: dominic@nursix.org
File Name: modules/s3db/event.py
Class Name: event_IncidentAssignMethod
Method Name: apply_method