def signin(): form = SignIn(request.form) try: _username = request.form['user'] _password = form.password.data data = acessa_sql('SELECT PASSWD FROM PASS WHERE LOGIN="******";') if len(data) > 0: me = User(_username, _password) if me.verifica_password(str(data[0][0]), _password): session['user'] = _username return redirect('/admin') else: return render_template('signin.html', error='Email ou senha errados.', form=form) else: return render_template('signin.html', error='Email ou senha errados.', form=form) except: return render_template('signin.html', form=form)
def acessa_login(_name, _email, _password): me = User(_email, _password) _hashed_password = me.seta_password(_password) parametros = _email, _hashed_password, _name acessa_proc('sp_createUser', parametros)