Пример #1
0
def candidate(uid):
    user = savvy_collection.find_one({ '_id': ObjectId(uid) })
    if user and user.get(CATEGORY) == CAND:
        return render('candidate.html', extra=user)
    else:
        flash('Invalid access to account', 'error')
        return redirect(url_for('home'))
Пример #2
0
def add():

    form = regoForm(request.form)
    if request.method == 'POST' and form.validate():
        return redirect(url_for('home'))

    return render('add.html', form=form)
Пример #3
0
def recover():
    if current_user and current_user.is_authenticated:
        return redirect(url_for('home'))

    form = recoverForm(request.form)
    if request.method == 'POST' and form.validate():
        return redirect(url_for('login'))
    return render('recover.html', form=form)
Пример #4
0
def change():
    email = request.form[EMAIL]
    user = savvy_collection.find_one({ EMAIL: email })
    form=None
    if email:
        if user:
            form = changepasswordForm(request.form,user)

            if request.method == 'GET':
                return render('changepassword.html', form=form)

            if request.method == 'POST' and form.validate():
                print('validated')
                return redirect(url_for('home'))

        return render('changepassword.html', form=form, extra=email)
    else:
        return redirect(url_for('home'))
Пример #5
0
def register():
    if current_user and current_user.is_authenticated:
        return redirect(url_for("home"))

    form = regoForm(request.form)
    if request.method == "POST" and form.validate():
        return redirect(url_for("account"))

    return render("register.html", form=form)
Пример #6
0
def change():
    email = request.form[EMAIL]
    user = savvy_collection.find_one({EMAIL: email})
    form = None
    if email:
        if user:
            form = changepasswordForm(request.form, user)

            if request.method == 'GET':
                return render('changepassword.html', form=form)

            if request.method == 'POST' and form.validate():
                print('validated')
                return redirect(url_for('home'))

        return render('changepassword.html', form=form, extra=email)
    else:
        return redirect(url_for('home'))
Пример #7
0
def jobSearch():
    # display all jobs
    jobs = jobs_collection.find()
    jobsDict = {}
    for elements in jobs:
        elements.pop('employerId', None)
        elements.pop('_id', None)
        jobsDict.update(elements)

    return render('jobSearch.html', extra=jobsDict)
Пример #8
0
def changepassword(email, password):
    user = savvy_collection.find_one({ EMAIL: email })
    form = changepasswordForm(request.form,user)

    if user:
        if User.validate_password(email, password):
            print (user)
            print('validated')
            print(current_user.get_id())
            return render('changepassword.html', form=form, extra=email)

    return redirect(url_for('home'))
Пример #9
0
def changepassword(email, password):
    user = savvy_collection.find_one({EMAIL: email})
    form = changepasswordForm(request.form, user)

    if user:
        if User.validate_password(email, password):
            print(user)
            print('validated')
            print(current_user.get_id())
            return render('changepassword.html', form=form, extra=email)

    return redirect(url_for('home'))
Пример #10
0
def postJob():
    email = current_user.get_id()[EMAIL]
    user = savvy_collection.find_one({EMAIL: email})
    if user and user.get(CATEGORY, None) == EMPL:
        form = jobForm(request.form)

        if request.method == 'POST' and form.validate():
            form.update(user)
            flash('successfully updated your job post', 'success')
            return redirect(url_for('account') + '#step4')

        return render('job.html', form=form)
    else:
        flash('Invalid access to account', 'error')
        return redirect(url_for('home'))
Пример #11
0
def postJob():
    email = current_user.get_id()[EMAIL]
    user = savvy_collection.find_one({ EMAIL: email })
    if user and user.get(CATEGORY, None) == EMPL:
        form = jobForm(request.form)

        if request.method == 'POST' and form.validate():
            form.update(user)
            flash('successfully updated your job post', 'success')
            return redirect(url_for('account') + '#step4')

        return render('job.html', form = form)
    else:
        flash('Invalid access to account', 'error')
        return redirect(url_for('home'))
Пример #12
0
def login():
    # Case: user is already logged in
    if current_user and current_user.is_authenticated:
        return redirect(url_for('home'))

    # Case: user submits form
    form = loginForm(request.form)
    if request.method == 'POST' and form.validate():
        print('validated')
        if request.form.get('next') != None and request.form.get('next') != 'None':
            return redirect(request.form.get('next'))
        else:
            return redirect(url_for('account'))

    # Case: user needs to log in
    return render('login.html', form)
Пример #13
0
def login():
    # Case: user is already logged in
    if current_user and current_user.is_authenticated:
        return redirect(url_for('home'))

    # Case: user submits form
    form = loginForm(request.form)
    if request.method == 'POST' and form.validate():
        print('validated')
        if request.form.get('next') != None and request.form.get(
                'next') != 'None':
            return redirect(request.form.get('next'))
        else:
            return redirect(url_for('account'))

    # Case: user needs to log in
    return render('login.html', form)
Пример #14
0
def account():
    user = savvy_collection.find_one({ EMAIL: current_user.get_id()[EMAIL] })
    userJob = jobs_collection.find_one({'employerId': user.get('_id', '')})
    if user:
        form = None
        if user.get(CATEGORY, '') == EMPL:
            form = employerForm(user, request.form)
        elif user.get(CATEGORY, '') == CAND:
            form = candidateForm(user, request.form)

        if request.method == 'GET':
            form.prepopulate(user)

        if request.method == 'POST':
            if form.validate():
                form.update(user.get(EMAIL))

        return render('account.html', form=form,
                                      error=None,
                                      jsonObject=None,
                                      extra=userJob)
    else:
        flash('Invalid access to account', 'error')
        return redirect(url_for('home'))
Пример #15
0
def about():
    return render('aboutus.html')
Пример #16
0
def terms():
    return render('terms.html')
Пример #17
0
def test():
    return render('test.html')
Пример #18
0
def homejobseekers():
    return render('homejobseekers.html', extra='homejobseekers')
Пример #19
0
def search():
    # Query all available candidates
    candidates = savvy_collection.find({ CATEGORY: CAND }) 
    return render('search.html', jsonObject=candidates)
Пример #20
0
def home():
    return render("home.html")
Пример #21
0
def search():
    # Query all available candidates
    candidates = savvy_collection.find({CATEGORY: CAND})
    return render('search.html', jsonObject=candidates)
Пример #22
0
def homejobseekers():
    return render('homejobseekers.html', extra='homejobseekers')
Пример #23
0
def about():
    return render('aboutus.html')
Пример #24
0
def home():
    return render('index.html', extra='')
Пример #25
0
def list():

    # Query all available candidates
    agencies = agency_collection.find()
    return render('list.html', jsonObject=agencies)
Пример #26
0
def home():
    return render('home.html', extra='')
Пример #27
0
def test():
    return render('test.html')
Пример #28
0
def home():
    return render('home.html', extra='')
Пример #29
0
def terms():
    return render('terms.html')