Esempio n. 1
0
    def post(self):
        uuid = request.json['uuid']
        unsigned_student = UnsignedStudentModel.get_unsigned_student(uuid)

        id = request.json['id']
        pw = request.json['password']

        StudentModel.signup(id, pw, unsigned_student)
        PointStatusModel(id).save()

        return Response('', 201)
Esempio n. 2
0
    def post(self):
        student = StudentModel.login(request.json['id'],
                                     request.json['password'])
        user_agent = request.headers.get('user-agent')
        token = TokenModel.create_new_token(student.id, user_agent)

        return jsonify(token)
Esempio n. 3
0
    def get_music_apply_status() -> dict:
        status = {week: [] for week in weekday}
        music_apply = MusicApplyModel.get_music_apply()

        if not music_apply:
            raise NoContentException()

        if music_apply is not None:
            for apply in music_apply:
                student = StudentModel.get_student_by_id(apply.student_id)
                status[weekday[apply.day]].append({
                    'id':
                    apply.id,
                    'musicName':
                    apply.song_name,
                    'singer':
                    apply.singer,
                    'studentId':
                    apply.student_id,
                    'applyDate':
                    str(apply.apply_date),
                    'studentName':
                    student.name
                })

        return status
Esempio n. 4
0
    def get(self):
        id = get_jwt_identity()
        student = StudentModel.get_student_by_id(id)
        info = PointStatusModel.get_point_status(id)

        info['number'] = student.number
        info['name'] = student.name

        return jsonify(info)
Esempio n. 5
0
    def post(self, platform: int):
        student_id = get_jwt_identity()
        student_name = StudentModel.get_student_by_id(student_id).name

        self.slack_bot.chat.post_message(
            channel='#bug-report',
            text='제보자: {}\n제보시간: {}\n플랫폼: {}\n내용: {}'.format(
                student_name,
                self.kst_now().strftime('%Y-%m-%d %H:%M:%S'),
                self.PLATFORM_TYPES[int(platform)], request.json['content']))

        return Response('', 201)
Esempio n. 6
0
    def post(self):
        id = request.json['id']
        email = request.json['email']
        student = StudentModel.get_student_by_id_email(id, email)

        find_pw = FindPWModel(student=student.id)

        mail_id = current_app.config['MAIL_ID']
        mail_pw = current_app.config['MAIL_PW']

        smtp = smtplib.SMTP(current_app.config['MAIL_SERVER'],
                            current_app.config['MAIL_PORT'])
        smtp.starttls()
        smtp.login(mail_id, mail_pw)

        msg = MIMEText(f'http://dms.istruly.sexy/account/pw/{find_pw.id}')
        msg['Subject'] = 'dms 비밀번호 초기화 링크'
        msg['To'] = '*****@*****.**'
        msg['From'] = mail_id

        smtp.sendmail(mail_id, '*****@*****.**', bytes(msg))

        return Response('', 201)