示例#1
0
 def POST(self):
     i = web.input()
     sf, wf = forms.signupform(), forms.wyrform()
     if not sf.validates(i):
         lf, pf = forms.loginform(), forms.petitionform()
         sf.fill(i), pf.fill(i), wf.fill(i)
         return render.petitionlogin(lf, sf, pf, wf)
     user = auth.new_user(i.email, i.password)
     helpers.set_login_cookie(i.email)
     create_petition(i, i.email)
     raise web.seeother("/%s" % i.pid)
示例#2
0
文件: app.py 项目: fahmed3/Journey42
def register():
    if request.method == 'POST':
        username = request.form.get('username')
        password = request.form.get('password')
        if auth.new_user(username, password):
            flash(
                'Account successfully created! Log in with your new account.')
            return redirect('login')
        else:
            flash('Registration error: Username is already in use.')
    return render_template('register.html')
示例#3
0
 def POST(self):
     i = web.input()
     sf, wf = forms.signupform(), forms.wyrform()
     if not sf.validates(i):
         lf, pf = forms.loginform(), forms.petitionform()
         sf.fill(i), pf.fill(i), wf.fill(i)
         return render.petitionlogin(lf, sf, pf, wf)
     user = auth.new_user(i.email, i.password)
     helpers.set_login_cookie(i.email)
     create_petition(i, i.email)
     raise web.seeother('/%s' % i.pid)
示例#4
0
def register():
    if request.method == 'POST':
        username = request.form.get('username')
        password = request.form.get('password')
        password_verify = request.form.get('password_verify')
        if password == password_verify:
            if auth.new_user(username, password):
                flash('Account successfully created!')
                return redirect('login')
            else:
                flash('Registration error: Username is already in use.')
        else:
            flash(
                'Registration error: The passwords you entered do not match.')
    return render_template('register.html')
示例#5
0
 def POST(self):
     i = web.input()
     sf, wf = forms.signupform(), forms.wyrform()
     if not sf.validates(i):
         lf, pf = forms.loginform(), forms.petitionform()
         sf.fill(i), pf.fill(i), wf.fill(i)
         return render.petitionlogin(lf, sf, pf, wf)
     user = auth.new_user(i.email, i.password)
     helpers.set_login_cookie(i.email)
     try:
         create_petition(i, i.email, wf)
     except CaptchaException:
         msg, msg_type = helpers.get_delete_msg()
         pf = forms.petitionform()
         pf.fill(i)
         return render.petitionform(pf, wf, msg)
         
     raise web.seeother('/%s' % i.pid)
示例#6
0
def register():
    if request.method == 'POST':
        user = request.form['email']
        pw = request.form["key"]

        pw_ver = request.form['key-confirm']
        if (pw == pw_ver):
            if auth.new_user(user, pw):
                session['alert-type'] = 'success'
                flash(
                    'Your account has been successfully created. Please log in.'
                )
                return redirect(url_for('login'))
            else:
                session['alert-type'] = 'error'
                flash('That email is already in use. Please use another one.')
        else:
            session['alert-type'] = 'error'
            flash('The passwords you entered do not match.')

    return render_template('register.html')