Beispiel #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'))
Beispiel #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)
Beispiel #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)
Beispiel #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'))
Beispiel #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)
Beispiel #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'))
Beispiel #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)
Beispiel #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'))
Beispiel #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'))
Beispiel #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'))
Beispiel #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'))
Beispiel #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)
Beispiel #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)
Beispiel #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'))
Beispiel #15
0
def about():
    return render('aboutus.html')
Beispiel #16
0
def terms():
    return render('terms.html')
Beispiel #17
0
def test():
    return render('test.html')
Beispiel #18
0
def homejobseekers():
    return render('homejobseekers.html', extra='homejobseekers')
Beispiel #19
0
def search():
    # Query all available candidates
    candidates = savvy_collection.find({ CATEGORY: CAND }) 
    return render('search.html', jsonObject=candidates)
Beispiel #20
0
def home():
    return render("home.html")
Beispiel #21
0
def search():
    # Query all available candidates
    candidates = savvy_collection.find({CATEGORY: CAND})
    return render('search.html', jsonObject=candidates)
Beispiel #22
0
def homejobseekers():
    return render('homejobseekers.html', extra='homejobseekers')
Beispiel #23
0
def about():
    return render('aboutus.html')
Beispiel #24
0
def home():
    return render('index.html', extra='')
Beispiel #25
0
def list():

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