Beispiel #1
0
def delete_account():
    """
    """
    form = ConfirmPasswordForm(request.form)
    if request.method == 'POST':
        if authenticate(current_user['username'], form.password.data):
            uid = current_user['_id']
            email = current_user['email']
            # Log the current user out
            be_signout()
            # Delete the account
            be_delete_account(uid)
            # Inform the user that the account has/is being deleted
            flash('Your account is being deleted<br />Thanks for using us',
                  'information')
            # Send the user their last ever email on Pjuu
            send_mail(
                'Pjuu Account Notification - Account Deletion',
                [email],
                text_body=render_template('emails/account_deletion.txt'),
                html_body=render_template('emails/account_deletion.html')
            )
            # Send user back to login
            return redirect(url_for('auth.signin'))
        else:
            flash('Oops! wrong password', 'error')

    return render_template('delete_account.html', form=form)
Beispiel #2
0
def delete_account():
    """
    """
    form = ConfirmPasswordForm(request.form)
    if request.method == 'POST':
        if authenticate(current_user['username'], form.password.data):
            uid = current_user['_id']
            email = current_user['email']
            # Log the current user out
            be_signout()
            # Delete the account
            be_delete_account(uid)
            # Inform the user that the account has/is being deleted
            flash('Your account is being deleted<br />Thanks for using us',
                  'information')
            # Send the user their last ever email on Pjuu
            send_mail(
                'Pjuu Account Notification - Account Deletion', [email],
                text_body=render_template('emails/account_deletion.txt'),
                html_body=render_template('emails/account_deletion.html'))
            # Send user back to login
            return redirect(url_for('auth.signin'))
        else:
            flash('Oops! wrong password', 'error')

    return render_template('delete_account.html', form=form)
Beispiel #3
0
def signout():
    """
    """
    if current_user:
        be_signout()
        flash('Successfully signed out', 'success')
    return redirect(url_for('auth.signin'))
Beispiel #4
0
def signout():
    """
    """
    if current_user:
        be_signout()
        flash('Successfully signed out', 'success')
    return redirect(url_for('auth.signin'))