예제 #1
0
def new_post(form):
    user = User(first_name=form.first_name.data,
                last_name=form.last_name.data,
                email_address=form.email_address.data,
                password=form.password.data)

    user.created_ip = request.remote_addr
    db.session.add(user)

    create_new_user_event(user)

    db.session.commit()

    return redirect(url_for('index'))
예제 #2
0
    def new_post(self, display_name, club, email_address, password, **kw):
        if not club:
            club = None

        user = User(display_name=display_name, club_id=club,
                    email_address=email_address, password=password)
        user.created_ip = request.remote_addr
        user.generate_tracking_key()
        DBSession.add(user)

        pilots = DBSession.query(Group).filter(Group.group_name == 'pilots').first()
        if pilots:
            pilots.users.append(user)

        redirect('/')
예제 #3
0
파일: users.py 프로젝트: bbonamin/Skylines
def new_post(form):
    user = User(
        first_name=form.first_name.data,
        last_name=form.last_name.data,
        email_address=form.email_address.data,
        password=form.password.data
    )

    user.created_ip = request.remote_addr
    db.session.add(user)

    create_new_user_event(user)

    db.session.commit()

    return redirect(url_for('index'))
예제 #4
0
파일: users.py 프로젝트: Adrien81/skylines
def new_post(form):
    user = User(
        first_name=form.first_name.data,
        last_name=form.last_name.data,
        email_address=form.email_address.data,
        password=form.password.data
    )

    user.created_ip = request.remote_addr
    db.session.add(user)

    create_new_user_event(user)

    db.session.commit()

    flash(_('Welcome to SkyLines, %(user)s! You can now log in and share your flights with the world!', user=user))

    return redirect(url_for('index'))
예제 #5
0
def new_post(form):
    user = User(first_name=form.first_name.data,
                last_name=form.last_name.data,
                email_address=form.email_address.data,
                password=form.password.data)

    user.created_ip = request.remote_addr
    db.session.add(user)

    create_new_user_event(user)

    db.session.commit()

    flash(
        _('Welcome to SkyLines, %(user)s! You can now log in and share your flights with the world!',
          user=user))

    return redirect(url_for('index'))
예제 #6
0
def new_post():
    json = request.get_json()
    if json is None:
        return jsonify(error='invalid-request'), 400

    try:
        data = CurrentUserSchema(only=('email', 'firstName', 'lastName', 'password')).load(json).data
    except ValidationError as e:
        return jsonify(error='validation-failed', fields=e.messages), 422

    user = User(**data)

    user.created_ip = request.remote_addr
    db.session.add(user)

    create_new_user_event(user)

    db.session.commit()

    return jsonify(user=UserSchema().dump(user).data)
예제 #7
0
def new_post(form):
    user = User(first_name=form.first_name.data,
                last_name=form.last_name.data,
                email_address=form.email_address.data,
                password=form.password.data)

    if form.club_id.data:
        user.club_id = form.club_id.data

    user.created_ip = request.remote_addr
    user.generate_tracking_key()
    db.session.add(user)

    create_new_user_event(user)
    if user.club_id:
        create_club_join_event(user.club_id, user)

    db.session.commit()

    return redirect(url_for('index'))
예제 #8
0
def new_post():
    json = request.get_json()
    if json is None:
        return jsonify(error="invalid-request"), 400

    try:
        data = (CurrentUserSchema(only=("email", "firstName", "lastName",
                                        "password")).load(json).data)
    except ValidationError as e:
        return jsonify(error="validation-failed", fields=e.messages), 422

    user = User(**data)

    user.created_ip = request.remote_addr
    db.session.add(user)

    create_new_user_event(user)

    db.session.commit()

    return jsonify(user=UserSchema().dump(user).data)
예제 #9
0
파일: users.py 프로젝트: imclab/skylines
def new_post(form):
    user = User(
        first_name=form.first_name.data,
        last_name=form.last_name.data,
        email_address=form.email_address.data,
        password=form.password.data
    )

    if form.club_id.data:
        user.club_id = form.club_id.data

    user.created_ip = request.remote_addr
    user.generate_tracking_key()
    db.session.add(user)

    create_new_user_event(user)
    if user.club_id:
        create_club_join_event(user.club_id, user)

    db.session.commit()

    return redirect(url_for('index'))
예제 #10
0
파일: users.py 프로젝트: kerel-fs/skylines
@users_blueprint.route('/new', methods=['POST'])
def new_post():
    json = request.get_json()
    if json is None:
        return jsonify(error='invalid-request'), 400

    try:
        data = CurrentUserSchema(only=('email', 'firstName', 'lastName',
                                       'password')).load(json).data
    except ValidationError, e:
        return jsonify(error='validation-failed', fields=e.messages), 422

    user = User(**data)

    user.created_ip = request.remote_addr
    db.session.add(user)

    create_new_user_event(user)

    db.session.commit()

    flash(
        _('Welcome to SkyLines, %(user)s! You can now log in and share your flights with the world!',
          user=user))

    return jsonify(user=UserSchema().dump(user).data)


@users_blueprint.route('/recover')
def recover():
예제 #11
0

@users_blueprint.route('/users', methods=['POST'], strict_slashes=False)
def new_post():
    json = request.get_json()
    if json is None:
        return jsonify(error='invalid-request'), 400

    try:
        data = CurrentUserSchema(only=('email', 'firstName', 'lastName', 'password')).load(json).data
    except ValidationError, e:
        return jsonify(error='validation-failed', fields=e.messages), 422

    user = User(**data)

    user.created_ip = request.remote_addr
    db.session.add(user)

    create_new_user_event(user)

    db.session.commit()

    return jsonify(user=UserSchema().dump(user).data)


@users_blueprint.route('/users/recover', methods=['POST'])
def recover_post():
    json = request.get_json()
    if json is None:
        return jsonify(error='invalid-request'), 400