Beispiel #1
0
def sign_in_company():
    data = request.json

    validate('sign_in_company', data)

    data = request.json

    hm_data = {
        "username": data.get('hm_email'),
        "password": data.get('hm_password'),
        "first_name": data.get('hm_first_name'),
        "last_name": data.get('hm_last_name'),
        "title": data.get('hm_title')
    }

    company_user = user.create_user(user_type=UserType.HIRING_MANAGER,
                                    **hm_data)

    company_data = {
        "name": data.get('company_name'),
        "description": data.get('company_description'),
        "contacts": {
            "email": data.get('hm_email')
        }
    }

    created_company = company.create_company_hiring_manager(
        admin_user_id=company_user['_id'], **company_data)

    return get_company(created_company['_id'])
Beispiel #2
0
 def post(self):
     username = self.get_argument('username')
     password = self.get_argument('password')
     repassword = self.get_argument('repassword')
     user_id = create_user(self, username, password, repassword)
     if user_id:
         self.write({'success': True, 'error': u''})
    def create(self, **qwargs):

        default_values = load_example_model(self.EXAMPLE_MODEL_NAME)

        if 'username' not in qwargs:
            default_values['username'] = self.fake.email()

        default_values.update(qwargs)

        return create_user(**default_values)
Beispiel #4
0
def create():
    request_data = request.json
    logger.debug('--request_data--' + str(request_data))
    result = create_user(request_data)
    if not result:
        return Response(status=500)

    obj = convert_user_from_mongo(result)
    response_data = json.dumps(obj)
    logger.debug('--response_data--' + response_data)
    resp = Response(response=response_data, status=201, content_type='application/json')
    return resp
Beispiel #5
0
def signUp(*args, **kwargs):

    if "logged_in" in session:
        return redirect(url_for("user.feed"))
    if request.method == "GET":
        return render_template("auth/signUp.html", **kwargs)

    username = request.form["username"]
    password = request.form["password"]
    print(password)
    usertype = 0
    email = request.form["email"]

    fullname = request.form["Full_Name"]
    phone = request.form["Mobile_Number"]
    locality = request.form["Locality"]
    street = request.form["Street"]
    building = request.form["Building"]
    apartment = request.form["Apartment"]
    city = request.form["City"]
    postcode = request.form["Pin_Code"]
    credit = request.form["Credit_Card"]
    country = request.form["Country"]

    NewAddress = createAddress(street, building, apartment, locality, city,
                               postcode)
    print(NewAddress)
    adressid = getAddressId(street, building, apartment, locality, city,
                            postcode)

    NewUser = create_user(username, password, email, usertype)
    print(NewUser)
    userid = getUserId(username, password, email, usertype)

    NewCustomer = createCustomer(fullname, adressid[0][0], phone, userid[0][0])
    print(NewCustomer)

    if NewUser is None:
        return render_template("auth/signUp.html",
                               msg="Record process is not done.",
                               **kwargs)
    return redirect(url_for("user.feed"))
Beispiel #6
0
def firmSignUp(*args, **kwargs):

    if "logged_in" in session:
        return redirect(url_for("user.feed"))
    if request.method == "GET":
        return render_template("auth/firmSignUp.html", **kwargs)

    password = request.form["password"]
    firm = request.form["First_Name"]
    usertype = 1
    email = request.form["email"]

    phone = request.form["Mobile_Number"]
    locality = request.form["Locality"]
    street = request.form["Street"]
    building = request.form["Building"]
    apartment = request.form["Apartment"]
    city = request.form["City"]
    postcode = request.form["Pin_Code"]
    tax = request.form["Tax_Number"]
    country = request.form["Country"]

    NewAddress = createAddress(street, building, apartment, locality, city,
                               postcode)
    print(NewAddress)

    adressid = getAddressId(street, building, apartment, locality, city,
                            postcode)

    NewUser = create_user(firm, password, email, usertype)
    print(NewUser)
    userid = getUserId(firm, password, email, usertype)

    NewFirm = createFirm(firm, adressid[0][0], userid[0][0], phone)

    print(NewFirm)
    if NewUser is None:
        return render_template("auth/firmSignUp.html",
                               msg="Record process is not done.",
                               **kwargs)
    return redirect(url_for("user.feed"))