Exemple #1
0
def activate():
    if current_user.activated:
        flash('Already activated. Welcome back!')
        return redirect(url_for('main.index'))
    current_user.activate()
    flash('Account reactivated! Welcome back!')
    return render_template('main.index')
Exemple #2
0
def joinTest():
    if(current_user.isActive == 0):
        current_user.activate()
        flash('You have joined the EmalTest, first Emal will be sent in random time.')
        sendmail()
    else:
        current_user.set_inactive()
        flash('You have exit the EmalTest.')
    db.session.commit()

    return redirect(url_for('index'))
Exemple #3
0
def activate(token):
    if current_user.active:
        return redirect(url_for('main.index'))
    if current_user.activate(token):
        flash('成功激活账户')
    else:
        flash('激活链接无效或者已过期')
    return redirect(url_for('main.index'))
Exemple #4
0
def activate(token):
    if current_user.active:
        return redirect(url_for('main.index'))
    if current_user.activate(token):
        flash('成功激活账户')
    else:
        flash('激活链接无效或者已过期')
    return redirect(url_for('main.index'))
Exemple #5
0
def activate(token):
    if current_user.active:
        flash("This user account has already been activated.")
        return redirect(url_for("main.index"))
    if current_user.activate(token):
        db.session.commit()
        flash("Account activated.")
    else:
        flash("Activation link invalid.")
    return redirect(url_for("main.index"))
Exemple #6
0
def activate(class_id):
    if not current_user.is_authenticated or not current_user.is_instructor:
        return redirect(url_for("index"))
    if not livesite() and current_user.stale_login:
        return redirect(url_for("logout"))
    current_user.acknowledge()
    try:
        flash_notify(current_user.activate(class_id))
    except Exception as err:
        msg = "Error activing class {0}{1!r}".format(
            type(err).__name__, err.args)
        log_event(current_user.kerb,
                  'activate',
                  status=-1,
                  detail={
                      'class_id': class_id,
                      'msg': msg
                  })
        if debug_mode():
            raise
        flash_error(msg)
    return redirect(url_for("instructor"))