Exemple #1
0
 def post(self):
     message = json.loads(self.request.body)
     no = message['student_no']
     username = message['student_name']
     password = message['password']
     if no and username and password:
         if Students.is_exists(student_no=no):
             self.finish(Result.already_register(message="该账号已经注册,请更换账号!"))
         else:
             Students.add_student(no, hashed(password))
             AuthInformation.initial(no, username)
             self.finish(Result.success(message="注册成功!"))
     else:
         self.finish(Result.not_this_message(message="信息输入不全面!请重新输入"))
Exemple #2
0
 def post(self):
     message = json.loads(self.request.body)
     teacher_no = message['teacher_no']
     teacher_name = message['teacher_name']
     password = message['password']
     email = message['email']
     if Teachers.is_exists(teacher_no):
         self.finish(Result.already_register(message="该用户已经注册"))
     else:
         result = Teachers.add_teacher(teacher_no, teacher_name,
                                       hashed(password), email)
         if result:
             self.finish(Result.success(message="信息添加成功!"))
         else:
             self.finish(Result.params_error(message="注册失败!参数出现错误,请重试!"))