Exemplo n.º 1
0
def activate(fellow, value=True):
    if value:
        fellow.set_verified(True)
        fellow.set_board(FELLOW_FELLOW, True)
        fellow.activate()
    else:
        fellow.deactivate()
Exemplo n.º 2
0
def verify(token):
    fellow = Fellow.decode_verification_token(token)
    if fellow is None:
        flash('Invalid verification token.')
        return redirect(url_for('base.index'))

    fellow.set_verified(True)
    flash('Your account has been verified')
    return redirect(url_for('fellow.login'))
Exemplo n.º 3
0
def seeddb():
    log.info('Seeding fellow db')
    admin = lada.fellow.register(
        email='*****@*****.**',
        password='******',
        name='Jedyny Słuszny',
        surname='Admin',
        studentid='62830',
    )

    admin.set_board(FELLOW_ACTIVE, True)
    admin.set_board(FELLOW_FELLOW, True)
    admin.set_board(FELLOW_BOARD, True)
    admin.set_board(POSITION_BOSS, True)
    admin.set_verified(True)

    names = {
        'Adrian', 'Zofia', 'Baltazar', 'Weronika', 'Cezary', 'Urszula',
        'Dominik', 'Telimena', 'Euzebiusz', 'Sabrina', 'Filemon', 'Roksana',
        'Grzegorz', 'Patrycja', 'Henryk', 'Ofelia', 'Iwan', 'Nina',
        'Jeremiasz', 'Monika', 'Klaus', 'Laura'
    }
    surs = {
        'Albinos', 'Bez', 'Chryzantema', 'Dalia', 'Ekler', 'Fiat', 'Gbur',
        'Hałas', 'Irys', 'Jabłoń', 'Kwiat', 'Lewak', 'Mikrus', 'Nektar',
        'Okular', 'Prokocim', 'Rabarbar', 'Sykomora', 'Trzmiel', 'Ul',
        'Wrotek', 'Zlew'
    }
    for i, p in enumerate(zip(names, surs)):
        fellow = lada.fellow.register(
            email=f'{p[1].lower()}.{p[0].lower()}@kms.uj.edu.pl',
            password=f'{p[0]}{i}{p[1]}',
            name=p[0],
            surname=p[1],
            studentid=i,
        )

        fellow.set_board(FELLOW_ACTIVE, True)
        fellow.set_board(FELLOW_FELLOW, True)
        fellow.set_verified(True)
    db.session.commit()
Exemplo n.º 4
0
def register():
    if current_user.is_authenticated:
        return redirect(url_for('base.index'))
    form = RegisterForm()
    if form.validate_on_submit():
        fellow = lada.fellow.register(email=form.email.data,
                                      password=form.password.data,
                                      name=form.name.data,
                                      surname=form.surname.data,
                                      studentid=form.studentid.data,
                                      newsletter=news_flags[NEWS_ALL])
        log.info(f"New fellow registered: {fellow}")
        if feature.is_active(FEATURE_EMAIL_VERIFICATION):
            send_verification_email(fellow)
            flash(
                'Registration successful. Please check your e-mail, including SPAM, for verification e-mail.'
            )
        else:
            fellow.set_verified(True)
            flash('Registration successful.')
        return redirect(url_for('fellow.login'))
    return render_template('fellow/register.html', form=form)
Exemplo n.º 5
0
def cli_activate(email, value):
    fellow = Fellow.query.filter_by(email=email).first()
    fellow.set_verified(value)