コード例 #1
0
def register():
    """
    User registration page
    """
    form = forms.StudentRegisterForm()
    if form.validate_on_submit():
        flash("Yippie, you have joined the Treehouse Alumni Site!", "success")
        models.Student.create_student(
            username=form.th_username.data,
            user_json=data_requests.request_user_data(form.th_username.data),
            email=form.email.data,
            first_name=form.first_name.data,
            last_name=form.last_name.data,
            password=form.password.data,
            github_username=form.github.data,
            city=form.city.data,
            state=form.state.data,
            country=form.country.data)

        # Now we'll send the email confirmation link
        subject = "Confirm your email"

        token = generate_confirmation_token(form.email.data)

        return redirect(url_for('index'))
    return render_template('register.html', form=form, title='Register')
コード例 #2
0
ファイル: app.py プロジェクト: ZyzzyxTech/leaderboard-python
def register():
    """
    User registration page
    """
    form = forms.StudentRegisterForm()
    if form.validate_on_submit():
        flash("Yippie, you have joined the Treehouse Alumni Site!", "success")
        models.Student.create_student(
            username=form.th_username.data,
            user_json=data_requests.request_user_data(form.th_username.data),
            email=form.email.data,
            first_name=form.first_name.data,
            last_name=form.last_name.data,
            password=form.password.data,
            github_username=form.github.data,
            city=form.city.data,
            state=form.state.data,
            country=form.country.data
        )

        # Now we'll send the email confirmation link
        subject = "Confirm your email"

        token = generate_confirmation_token(form.email.data)

        return redirect(url_for('index'))
    return render_template('register.html', form=form, title='Register')
コード例 #3
0
ファイル: __init__.py プロジェクト: Paymiumm/smFiles
def activateMail(email):
    try:
        token = generate_confirmation_token(email)
        html = render_template(
            'activateMail.html',
            confirm_url='http://127.0.0.1:8000/account/confirMail/' + token,
            email='http://127.0.0.1:8000/account/resendConfirmation?email=' +
            email)

        subject = 'Paymiumm: Confirm Your Account'

        send_email(email, subject, html)
        return True
    except Exception, e:
        print e
        return False