def register(): """ Register method for creating a PyBossa account. Returns a Jinja2 template """ # TODO: re-enable csrf form = RegisterForm(request.form) if request.method == 'POST' and form.validate(): if not request.form.get('survey_check', None) == None: survar="0" else: survar="None" account = model.User(fullname=form.fullname.data, name=form.username.data, email_addr=form.email_addr.data, survey_check=survar) account.set_password(form.password.data) account.locale = get_locale() db.session.add(account) db.session.commit() login_user(account, remember=True) flash(gettext('Thanks for signing-up'), 'success') return redirect(url_for('home')) if request.method == 'POST' and not form.validate(): flash(gettext('Please correct the errors'), 'error') return render_template('account/register.html', title=gettext("Register"), form=form)
def create_fb_user(self, user_full_name, user_name, user_email, fb_user_id): try: account = User(fullname=user_full_name, name=user_name, email_addr=user_email) account.set_password(user_email) account.locale = get_locale() account.facebook_user_id = fb_user_id db.session.add(account) db.session.commit() return Response(json.dumps({"response": "OK"}), mimetype="application/json") except Exception as e: return error.format_exception(e, target=self.__class__.__name__.lower(), action='CREATE_FB_USER')
def register(): # TODO: re-enable csrf form = RegisterForm(request.form) if request.method == 'POST' and form.validate(): account = model.User(fullname=form.fullname.data, name=form.username.data, email_addr=form.email_addr.data) account.set_password(form.password.data) account.locale = get_locale() db.session.add(account) db.session.commit() login_user(account, remember=True) flash(lazy_gettext('Thanks for signing-up'), 'success') return redirect(url_for('home')) if request.method == 'POST' and not form.validate(): flash(lazy_gettext('Please correct the errors'), 'error') return render_template('account/register.html', title=lazy_gettext("Register"), form=form)
def create_fb_user(self, user_full_name, user_name, user_email, fb_user_id): try: account = User(fullname=user_full_name, name=user_name, email_addr=user_email) account.set_password(user_email) account.locale = get_locale() account.facebook_user_id = fb_user_id db.session.add(account) db.session.commit() return Response(json.dumps({"response": "OK"}), mimetype="application/json") except Exception as e: return error.format_exception( e, target=self.__class__.__name__.lower(), action='CREATE_FB_USER')
def register(): # TODO: re-enable csrf form = RegisterForm(request.form) if request.method == 'POST' and form.validate(): account = model.User(fullname=form.fullname.data, name=form.username.data, email_addr=form.email_addr.data) account.set_password(form.password.data) account.locale = get_locale() db.session.add(account) db.session.commit() login_user(account, remember=True) flash(gettext('Thanks for signing-up'), 'success') return redirect(url_for('home')) if request.method == 'POST' and not form.validate(): flash(gettext('Please correct the errors'), 'error') return render_template('account/register.html', title=gettext("Register"), form=form)
def register(): """ Register method for creating a PyBossa account. Returns a Jinja2 template """ # TODO: re-enable csrf form = RegisterForm(request.form) if request.method == "POST" and form.validate(): account = model.User(fullname=form.fullname.data, name=form.username.data, email_addr=form.email_addr.data) account.set_password(form.password.data) account.locale = get_locale() db.session.add(account) db.session.commit() login_user(account, remember=True) flash(gettext("Thanks for signing-up"), "success") return redirect(url_for("home")) if request.method == "POST" and not form.validate(): flash(gettext("Please correct the errors"), "error") return render_template("account/register.html", title=gettext("Register"), form=form)