def setPasswordView(tok=None): form = setPasswordForm() if form.validate_on_submit(): dataDict={'password':form.password.data} req = authAPI('setPassword', method='post', dataDict=dataDict, token=tok) if 'error' in req: errorMessage(req['error']) elif 'success' in req: successMessage('Your password has now been set, please login') return redirect(url_for('authBP.loginView')) return render_template('auth/setPassword.html', form=form)
def setPasswordView(lang='dk', tok=None): g.lang = lang kwargs = {'formWidth':300, 'contentTitle':str(tok), 'title':messageText('setPasswordTitle'), 'breadcrumbs': breadCrumbs('authBP.setPasswordView')} form = setPasswordForm() if form.validate_on_submit(): req = authAPI('setPassword', method='post', dataDict=dataDict, token=session['token']) if r.status_code == 404: flashMessage('userDoesNotExist') elif 'success' in req: flashMessage('passwordSet') return render_template(lang+'/auth/setPasswordForm.html', form=form, **kwargs)
def setPasswordView(tok): session.clear() kwargs = {'formWidth': 300, 'title': 'Set new password'} form = setPasswordForm() if form.validate_on_submit(): dataDict = {'password': form.password.data} req = authAPI('setPassword', method='post', dataDict=dataDict, token=tok) print str(req) if 'error' in req: errorMessage(req['error']) elif 'success' in req: successMessage('Your password has now been set, please login') return redirect(url_for('authBP.loginView')) return render_template('auth/setPasswordForm.html', form=form, **kwargs)
def setPasswordView(tok): if session['token']: session['token'] = None kwargs = {'formWidth': 300, 'title': 'Set new password'} form = setPasswordForm() if form.validate_on_submit(): dataDict = {'password': form.password.data} print form.password.data req = authAPI('setPassword', method='post', dataDict=dataDict, token=tok) if 'error' in req: if req['error'] == 'Could not identify access token': errorMessage(req['error']) elif req['error'] == 'Could not identify Platform': errorMessage(req['error']) elif req['error'] == 'Request data incomplete': errorMessage(req['error']) elif req['error'] == 'Illegal null values present in request data': errorMessage(req['error']) elif req['error'] == 'Invalid access token': errorMessage(req['error']) else: errorMessage(req['error']) elif 'success' in req: successMessage('Your password has now been set, please login') return redirect(url_for('authBP.loginView')) return render_template('auth/setPasswordForm.html', form=form, **kwargs)