def register_user(): name = request.form['name'] lastname = request.form['lastname'] email = request.form['email'] password = request.form['password'] phote = request.files['file'] if phote and allowed_file(phote.filename): # Make the filename safe, remove unsupported chars filename = secure_filename(phote.filename) # Move the file form the temporal folder to # the upload folder we setup if not os.path.exists(fullpath): #The folder to send the file if something is goes wrong PATH ='C:\\Users\hacker\desktop\startup\machine\Assets\empyt_folder' #config path folder app.config['UPLOAD_FOLD'] = PATH #changing dir os.chdir('C:\\users\hacker\desktop\startup\machine\static\Assets') # make a new folder os.mkdir("empyt_folder") file_name = secure_filename(phote.filename) phote.save(os.path.join(app.config['UPLOAD_FOLD'],file_name)) Users.registration(reguest.form['name'], request.form['lastname'], equest.form['email'],request.form['password'],filename) else: filename = secure_filename(phote.filename) phote.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) Users.registration(request.form['name'] ,request.form['lastname'],request.form['email'],request.form['password'],filename) #return redirect(url_for('uploaded_file',filename=filename)) return redirect(url_for(Templates.elslogin('login')))
def register_process(): regform = Form(request.form) if request.method == 'POST' and request.cookies.get('login_email') is None: print(request.form['firstname']) reg = RegisterForm(request.form['firstname'],request.form['lastname'],request.form['email'],request.form['password'],request.form['confirm'],request.files['file']) size=128 dig = md5(request.form['email'].lower().encode('utf-8')).hexdigest() image = 'https://www.gravatar.com/avatar/{}?d=identicon&s={}'.format(dig, size) user_name = request.form['firstname'].lower() f = reg.filename filename = secure_filename(f.filename) email = request.form['email'].lower() password = request.form['password'].lower() confirm = request.form['confirm'].lower() if Users.get_by_email(request.form['email'].lower()) != True and reg.PasswordMatch(password, confirm) == True and reg.notEmpty() == True: mail = Mail("*****@*****.**", email) mail.sendMail() f.save(os.path.join(os.getcwd() +'/static/uploads/reg', filename)) print(reg.notEmpty()) Users.registration(request.form['firstname'], request.form['lastname'] , request.form['email'], request.form['password'], request.files['file'].filename, image=image) return redirect(url_for('success_full_reg')) else: flash("One or more inputs is empty or ") flash("There is a user with that email") flash("please make sure every input is entered") return render_template('register.html', title='register', regform=regform) flash("There is a problem") return render_template('register.html', title='register', regform=regform)