def signUP(): if request.method == 'POST': name = request.form['name'] if (len(name) > 6): pw = request.form['pw'] pwr = request.form['pwr'] if (pw == pwr): try: db.signup(name, pw) return redirect(urllib2.quote("success/user/회원가입")) except: return redirect(urllib2.quote("fail/user/회원가입")) return redirect(urllib2.quote("fail/user/회원가입"))
def form_validation(): #send data from signup form to the database if request.method == 'POST': error = None eid = request.form['empid'] username = request.form['username'] password = request.form['password'] if not username: error = 'Username is required' elif not password: error = 'Password is required' if error is None: database.signup(eid, username, password) return redirect(url_for('login')) flash('user registration sucessfull') flash(error) return render_template('form_validation.html')
def auth(): if "email" in session: CODE = str(random.randrange(1000, 9999)) if request.method == "POST": data = request.get_json() code = data["auth_code"] print(code) if code == session["auth-code"]: db.signup(session) email = session["email"] session.clear() session["auth_field"] = email session["perms"] = "ADMIN" return jsonify(url_for("dashboard")) else: return jsonify(404) session["auth-code"] = CODE email_auth(session["email"], CODE) return render_template('email.auth.html')
def admin(): if request.method == 'POST': form = request.form code = form['code'] user = db.getUserByCode(code) if (user != None): return render_template('codexist.html') if (db.signup(None, code, None, None, None, None, None, None, None, None)): return render_template('admin.html') return "something went wrong"
def SignUpForm(): if request.method == 'POST': form = request.form username = form['username'] password = form['password'] email = form['email'] user = db.getUserByUsername(username) if(user != None): return render_template("staken.html") if(db.signup(username, password, email)): return render_template("success.html") return "something went wrong"
def SigninForm(): if request.method == 'POST': form = request.form name = form['name'] code = form['code'] phonenumber = form['phonenumber'] firsthalfB = form['firsthalfB'] firsthalfR = form['firsthalfR'] secondhalfB = form['secondhalfB'] secondhalfR = form['secondhalfR'] finalB = form['finalB'] finalR = form['finalR'] corner = form['corner'] user = db.getUserByCode(code) if (user != None): db.delete(code) db.signup(name, code, phonenumber, firsthalfB, firsthalfR, secondhalfB, secondhalfR, finalB, finalR, corner) return render_template('success.html') if (user == None): return render_template('cdexist.html') return "something went wrong"
def signup(): emp_id = request.form['emp_id'] emp_password = request.form['emp_password'] emp_name = request.form['emp_name'] emp_age = request.form['emp_age'] try: success = db.signup(emp_id, emp_password, emp_name, emp_age) if success: return "success" else: return "failed" except: return "failed"
def signup(): ''' Creates a user with an email, hashed password, push_token, and randomized salt. ''' data_dict = request.get_json() email = data_dict.get("email", "") password = data_dict.get("password", "") push_token = data_dict.get("push_token", "") response = {"outcome": "failure"} if email and password and push_token: user = db.signup(email, password, push_token) response["token"] = db.get_token(user) response["outcome"] = "successful" return jsonify(response)
def handle_client_req(con, req, check_datas, cur, admin_key): is_signin, is_admin, is_exit = check_datas res = '' cmd = req.split()[0] para = tuple(req.split()[1:]) if not is_valid_cmd(cmd, para): res = 'Invalid command' else: if cmd == '!exit': is_exit = True res = '!exit' else: if not is_signin: if cmd == '!su': res = db.signup(cur, para, admin_key) elif cmd == '!si': res, is_admin, is_signin = db.signin(cur, para) else: res = 'Sign in first' else: if cmd == '!su' or cmd == '!si': res = 'You\'ve already signed in' elif cmd != '!help': if cmd == '!ls': res = db.get_all_match(cur) elif cmd == '!scr': match_id = para[0] res = db.get_all_event(cur, match_id) else: if not is_admin: res = 'You are not admin' else: if cmd == '!ism': ism_datas = literal_eval(para[0]) match_datas = ism_datas[0] event_datas = ism_datas[1] db.insert_match(cur, match_datas, event_datas) res = 'insert match successfully' if cmd == '!help': res = [ '!su [username] [password] [key] : sign up (with key if you are admin)', '!si [username] [password] : sign in', '!ls : show the list of all matches', '!scr [id] : show the score of the given id', '!help : show this help' ] con.sendall(attach_send(res)) return is_signin, is_admin, is_exit
def login(): print "inside login" if request.method == 'GET': return "dosnt support this platform" if request.method == 'POST': if request.is_json: Username = request.get_json()['Username'] Password = request.get_json()['Password'] Email = request.get_json()['Email'] user = User(Username=Username, Password=Password, Email=Email) result = db.signup(user) if result == False: reply = user.to_json() else: reply = "[ \"dosnt exist\"]" else: reply = "only supports json" print reply return reply
def signUp(): print "inside sign up" if request.method == 'GET': return "doesnt support this platform " if request.method == 'POST': if request.is_json: Username = request.get_json()['username'] Password = request.get_json()['password'] Email = request.get_json()['email'] user = User(Username=Username, Password=Password, Email=Email) result = db.signup(user) if result == True: reply = user.to_json() else: reply = "[ \"already taken\"]" else: reply = "only supports json" print reply return reply