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'))
def add(): form = regoForm(request.form) if request.method == 'POST' and form.validate(): return redirect(url_for('home')) return render('add.html', form=form)
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)
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'))
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)
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'))
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)
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'))
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'))
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'))
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'))
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)
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)
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'))
def about(): return render('aboutus.html')
def terms(): return render('terms.html')
def test(): return render('test.html')
def homejobseekers(): return render('homejobseekers.html', extra='homejobseekers')
def search(): # Query all available candidates candidates = savvy_collection.find({ CATEGORY: CAND }) return render('search.html', jsonObject=candidates)
def home(): return render("home.html")
def search(): # Query all available candidates candidates = savvy_collection.find({CATEGORY: CAND}) return render('search.html', jsonObject=candidates)
def home(): return render('index.html', extra='')
def list(): # Query all available candidates agencies = agency_collection.find() return render('list.html', jsonObject=agencies)
def home(): return render('home.html', extra='')