Esempio n. 1
0
def uregister(request):
    name=request.POST.get("r1")
    contact=request.POST.get("r2")
    password=request.POST.get("r3")
    reg=Register(Name=name,Password=password,Contact=contact)
    reg.save()
    return render(request,"login.html",{"reg":reg,"msg":"saved"})
Esempio n. 2
0
def resetpassword(request):
    if request.method == 'POST':
        email = request.session['sessionuser']
        print('0000000000000', email)
        oldpassword = request.POST['oldpassword']
        getoldpasswordfromdb = Register.objects.get(email=email)
        if oldpassword == getoldpasswordfromdb:
            passwordchanged = Register(password=oldpassword)
            passwordchanged.save()
            return render_to_response("resetpassword.html", {
                'status': 'True',
                'mess': 'Password changed successfully'
            },
                                      content_type=RequestContext(request))
        else:
            return render_to_response("resetpassword.html", {
                'status': 'False',
                'mess': 'Old password not match'
            },
                                      content_type=RequestContext(request))
        newpassword = request.POST['password']
        confirmpassword = request.POST['confirmpassword']
        if confirmpassword != newpassword:
            return render_to_response(
                "resetpassword.html", {
                    'status': 'False',
                    'mess': 'ConfirmPassword not match with NewPassword'
                },
                content_type=RequestContext(request))

    return render_to_response("resetpassword.html",
                              context_instance=RequestContext(request))
Esempio n. 3
0
def register(request):
    if request.method == "POST":
        fname = request.POST['fullname']
        uname = request.POST['username']
        pword = request.POST['password']
        #password = hashlib.md5(pword).hexdigest()
        #print(password)
        eid = request.POST['emailid']
        checkuser = Register.objects.filter(emailid=eid).exists()
        if checkuser == True:
            return render_to_response("register.html", {
                'mess': 'Email id already in use.Please check another emailid',
                'status': 'False'
            },
                                      context_instance=RequestContext(request))
        print(checkuser)
        if checkuser == False:
            registersers = Register(
                fullname=fname,
                username=uname,
                #password = md5_crypt.encrypt(pword),
                #password = hashlib.md5(pword),
                #password = hashlib.new(pword).hexdigest(),
                password=pword,
                emailid=eid)
            registersers.save()
            return render_to_response("login.html", {
                'mess': 'Registration successfully',
                'status': 'True'
            },
                                      context_instance=RequestContext(request))

    return render_to_response("register.html",
                              context_instance=RequestContext(request))
Esempio n. 4
0
def register():
	if current_user.is_authenticated:
		return redirect(url_for('main.index'))
	form=RegistrationForm()
	if form.validate_on_submit():
		register=Register(username=form.username.data,email=form.email.data,name=form.name.data,phone=form.phone.data,verified=0)
		register.set_password(form.password.data)
		
		db.session.add(register)
		db.session.commit()
		send_register_verify_email(register)
		flash('您的申请已提交,系统将自动发送确认邮件至您填写的邮箱地址,请通过该邮件进行邮箱地址认证!')
		return redirect(url_for('auth.login'))
	return render_template('auth/register.html',title='注册',form=form)
Esempio n. 5
0
def index():
    mongo_data = mongo.db.pins

    # implemnting while loop to ensure that the random generated pin doesn't already exist in the database
    counter = 1
    while counter >= 1:
        pin = random_digits(15)
        pin1 = mongo_data.find_one({'pin': pin})

        if pin1:
            print('again')
            counter = counter + 1
        else:
            print(pin)
            break

    save = Register(pin=str(pin))
    db.session.add(save)
    db.session.commit()
    serial_number = Register.query.filter_by(pin=str(pin)).first()
    pin1 = pin
    sn = twelve_digit_serial_no(serial_number.s_n)

    # storing to mongo db
    mongo_data.insert({
        'serial_no': sn,
        'pin': pin1,
        'assigned': 0,
        'value': 0
    })

    return jsonify({'serial number': sn, 'PIN': pin1})
Esempio n. 6
0
def registers(registertype, registerdomain):
    reg = db.session.query(Register).filter().order_by(desc(
        Register.id)).first()
    val = int(reg.register)
    newregister = val + 1
    dateyear = date.today().year
    now = datetime.now()
    registerdate = now.strftime("%B") + str(dateyear)
    register = Register(newregister, registerdate, registertype,
                        registerdomain)
    db.session.add(register)
Esempio n. 7
0
def register_verify(token):
	if current_user.is_authenticated:
		print('0')
		return redirect(url_for('main.index'))
	register=Register.verify_register_verify_token(token)
	if not register:
		print('1')
		return redirect(url_for('main.index'))
	register.verify()
	db.session.commit()
	flash('邮箱认证成功!请等待系统管理员审核,审核时间大约1-2个工作日。')
	return redirect(url_for('main.index'))
Esempio n. 8
0
def register():

    form = RegisterForm()
    
    if form.validate_on_submit():

        resident = Register(firstname=form.firstname.data, lastname=form.lastname.data, middlename=form.middlename.data, email=form.email.data, mobile=form.mobile.data, alias=form.alias.data)
        
        db.session.add(resident)
        db.session.commit()
        flash("Created")
        return redirect(url_for('index'))


    return render_template('index.html', form=form)
def capture_otp(course_code):
    form = RegisterForm()  # pragma: no cover
    course = Course.query.filter_by(
        course_code=course_code).first_or_404()  # pragma: no cover
    if form.validate_on_submit():  # pragma: no cover
        tutor = Tutor.query.filter_by(
            id_number=form.id_number.data).first_or_404()
        if tutor not in course.enrolled_tutors:
            flash('Student is not enrolled in this course')
            return redirect(
                url_for('register.capture_otp', course_code=course_code))
        else:  # pragma: no cover
            reg = Register(otp=form.otp.data, courses=course, attendance=tutor)
            db.session.add(reg)
            tutor.otp = random.randint(10000000, 50000000)
            db.session.commit()
            flash('The tutor has been captured')
            return redirect(
                url_for('register.capture_otp', course_code=course_code))
    return render_template('register/capture_otp.html',
                           title='Capture One time pin',
                           form=form)  # pragma: no cover
Esempio n. 10
0
def welcomePage(request):
    fname = request.POST['fname']
    lname = request.POST['lname']
    pnumber = request.POST['pnumber']
    Register(fname=fname, lname=lname, phonenumber=pnumber).save()
    return render(request, 'welcome.html')
Esempio n. 11
0
def create_new_register(**kwargs) -> Register:
    register = Register(**kwargs)
    return save(register)
Esempio n. 12
0
 def setUp(self):
     """
     Set up method that will run before every Test
     """
     self.new_register = Register("tuitoek", "*****@*****.**", "ssjtk123",
                                  "sjtk123")
Esempio n. 13
0
 def setUp(self):
     '''
     Set up method that will run before every Test
     '''
     self.new_register = Register()