Example #1
0
def join_us():
    join_form = form.RegisterForm()
    if join_form.validate_on_submit():
        try:
            ret = user_server.create_user(join_form, 8)
            if ret == 'OK':
                #send_register_success(join_form.email.data, _app_ctx_stack.top, join_form)
                flash(u"提交申请成功")
            else:
                flash(u"提交申请失败: " + ret)
        except Exception, e:
            flash(u"提交申请失败: " + e.message)
Example #2
0
def create_user():
    if not current_user.is_admin and not current_user.is_coach:
        return redirect(url_for('main.index'))
    reg_form = form.RegisterForm()
    if reg_form.validate_on_submit():
        try:
            rights_list = request.form.getlist('rights')
            rights = 0
            for item in rights_list:
                rights = rights | int(item)
            ret = user_server.create_user(reg_form, rights)
            if ret == 'OK':
                return u"添加用户成功"
            return u"添加用户失败: " + ret
        except Exception, e:
            return u"添加用户失败: " + e.message