Beispiel #1
0
    def remove(self):
        servers = ServiceSettings.objects()
        for server in servers:
            server.remove_provider(current_user)

        current_user.delete()
        return redirect(url_for('HomeView:index'))
Beispiel #2
0
def setting(path):
    form = None
    if path == "profile":
        form = UserInfoForm()
    elif path == "message":
        pass
    elif path == "account":
        form = UserPassEditForm()
    elif path == "delete":
        form = DeleteUserForm()
    else:
        abort(404)

    if form and form.validate_on_submit():
        if path == "profile":
            current_user.email = form.email.data
            current_user.update()
        elif path == "message":
            pass
        elif path == "account":
            current_user.update_password(form.new_password.data)
            logout_user()
            return redirect(url_for("view.login"))
        elif path == "delete":
            current_user.delete()
            return redirect(url_for("view.home"))

    if path == "profile":
        form.username.data = current_user.username
        form.email.data = current_user.email
    return render_template("setting/{}.html".format(path), form=form)
Beispiel #3
0
def delete_account():
    form = DeleteAccountForm()
    if form.validate_on_submit():
        current_user.delete()
        flash('Account deleted permanently, goodbye!', 'success')
        return redirect(url_for('blog.index'))
    return render_template('user/delete_account.html', form=form)
Beispiel #4
0
def settings_delete_account():
    form = SettingsDeleteAccountForm()
    if form.validate_on_submit():
        current_user.delete()
        NotificationHelper(notifier=current_user).delete_by_user()
        current_user.commit()
        flash('Your account has been removed.')
        return redirect(url_for('users.home'))
    return render_template('users/settings/delete-account.html', form=form)
Beispiel #5
0
def delete_user():
    utils.unregister_yodlee_user_or_400(
        session['cobrand_session_token'],
        session['user_session_token'],
    )
    current_user.delete()
    logout_user()
    flash('Your account was deleted')
    return redirect(url_for('.index'))
Beispiel #6
0
def delete_user():
    utils.unregister_yodlee_user_or_400(
        session['cobrand_session_token'],
        session['user_session_token'],
    )
    current_user.delete()
    logout_user()
    flash('Your account was deleted')
    return redirect(url_for('.index'))
Beispiel #7
0
def delete_account(token=None):
    if current_user.is_authenticated() and not current_user.email_confirmed:
        current_user.delete()
    elif token:
        pass
    else:
        if request.referrer:
            return redirect(url_for(request.referrer))
        return redirect(url_for('dashboard'))
    db.session.commit()
    return redirect(url_for('index'))
Beispiel #8
0
def delete_account():
    delete_user()

    form = DeleteAccountForm()

    if form.validate_on_submit():
        current_user.delete()

        flash('Your account has been successfully deleted. Hope to see you again.', 'success')
        return redirect(url_for('users.home'))

    return render_template('users.home.html', form=form)
Beispiel #9
0
def deleteaccount():
    if request.method == 'POST':
        for i in Relationship.query.filter_by(
                userid=current_user.userid).all():
            i.delete()
        for i in Relationship.query.filter_by(
                frienduserid=current_user.userid).all():
            i.delete()
        current_user.delete()
        logout_user()
        flash('You were just logged out and your account was removed',
              category='success')
        return redirect(url_for('main.welcome'))
    return {"message": "Delete not possible with get method"}
Beispiel #10
0
def delete_account():
    if request.method == "POST":
        if request.form["password"]:
            password = request.form["password"]
            if current_user.verify_password(password):
                username = current_user.username
                current_user.delete()
                current_app.logger.info(f"User {username} deleted.")
                flash(_("Your account has been deleted"), "blue")
            else:
                flash(_("Your password is invalid!"), "yellow")
            return redirect(url_for("main.main"))
        else:
            abort(400)
    return render_template("auth/delete_account.html")
Beispiel #11
0
def settings_delete_account_POST():
    form = DeleteUserForm(request.form)

    if not form.validate_on_submit():
        return render_template(
            'user/settings-delete-account.html',
            form=form,
        ), 400

    send_delete_account_email(current_user)

    current_user.delete()

    flash('Your account has been deleted.', 'info')

    return redirect(url_for('home.index_GET'))
Beispiel #12
0
    def wrapper_decorator(*args, **kwargs):
        try:
            pubsub = redis.pubsub(ignore_subscribe_messages=True)
            current_user.set_connected(True)
            yield from func(pubsub, *args, **kwargs)
        finally:
            # print("Connection lost to {}".format(current_user.name))
            current_user.set_connected(False)
            current_user.set_status(
                "busy"
            )  # TODO: if recconection -- change of status might be not visible in frontend
            pubsub.close()

            sleep(15)
            db.session.refresh(current_user)
            if not current_user.connected:
                # print("Deleting ", current_user.name)
                current_user.delete()
Beispiel #13
0
def user_delete():
    """
    Delete a user
    ---
    delete:
        summary: User deletion endpoint.
        description: Delete a user from DB.
        responses:
            200:
                description: User was deleted
    """
    try:
        current_user.delete()
    except Exception as e:
        logger.exception(f'Failed to delete user. Error {e}')
        return make_response(jsonify({MESSAGE_KEY: 'Failed to delete user'}),
                             HTTPStatus.INTERNAL_SERVER_ERROR)

    return make_response(jsonify({MESSAGE_KEY: 'Success'}), HTTPStatus.OK)
def delete():
    if request.method == 'GET':
        return render_template('profile/delete.html')
    else:
        password = request.form.get('password')
        confirm_password = request.form.get('confirm_password')

        if not check_password_hash(current_user.password, password)\
            or not check_password_hash(current_user.password, confirm_password):
            flash('Invalid information provided.')
            return redirect(url_for('profile.delete'))

        current_user.delete()
        commit()

        logout_user()
        session.permanent = False

        return redirect(url_for('main.index'))
def delete_account():
    """Delete current user's account"""
    current_user.delete()
    flash("Account deleted!", category="success")
    return redirect(url_for("core.index"))
Beispiel #16
0
def delete():
    if request.method == 'POST':
        current_user.delete()
        return redirect(url_for('frontend.index'))
    return render_template('profile/delete.html')
Beispiel #17
0
 def post(self):
     current_user.delete()
     return {"message": True}
Beispiel #18
0
 def remove(self):
     current_user.delete()
     return redirect(url_for('HomeView:index'))
def delete():
    if request.method == 'POST':
        current_user.delete()
        return redirect(url_for('frontend.index'))
    return render_template('profile/delete.html')
Beispiel #20
0
def delete(id, filename):
    if current_user.id == id:
        f = db.File(id, filename)
        current_user.delete(f)
        return redirect(url_for('account', id=id, msg='File deleted'))
    abort(404)
Beispiel #21
0
def permanently_deleteme():
    current_user.delete()
    logout_user()
    flask.flash(Markup("Your account has been deleted.  Have a nice day!"))
    return redirect(url_for(".info"))
Beispiel #22
0
 def delete(self):
     current_user.delete()
     logout_user()
     return unauthentified_data