def post(self): form = OriginOJAccountForm() account = form.generate_account() account.save() current_user.update(hdu=account) account_init.delay( form.origin_oj.data, form.username.data, form.password.data ) return redirect(url_for('user.origin_oj'))
def get(self): user = current_user if user.sdut: if request.args.get('unbind', None): if user.sdut.status == 'Unauthorized': flash('Your account is unauthorized.') else: user.sdut.delete() flash('Unbind success.') elif request.args.get('refresh', None): account_init.delay( user.sdut.origin_oj, user.sdut.username, user.sdut.password ) return redirect(url_for('user.origin_oj'))