Ejemplo n.º 1
0
	def get(self):
		redirect = str(self.request.get('redirect'))
		if not redirect:
			redirect = '/'
		user = authentication.getUser(self)
		if user and user.openID:
			redirect = users.create_logout_url(redirect)
		authentication.deleteCookie(self)
		self.redirect(redirect)
Ejemplo n.º 2
0
def login():
    name = request.form.get('email')
    password = request.form.get('psw')

    if not name or not password:
        return redirect(linkHttpApp, code=400)

    if not auth.getUser(name):
        return jsonify({"res": "NO USER"}), 404

    if not auth.verifyPass(name, password):  # retorna true caso seja igual
        return jsonify({"res": "wrong password"}), 400
    token = auth.createToken(name, password)

    data = {'token': token}
    print(data, flush=True)
    return jsonify(data), 200
Ejemplo n.º 3
0
def login():
    name = request.form.get('nickname')
    password = request.form.get('password')

    if not name or not password:
        return redirect(linkMailApp, code=400)

    if not authentication.getUser(name):
        return jsonify({"res": "NO USER"}), 404

    if not authentication.verifyPass(name,
                                     password):  #retorna true caso seja igual
        return jsonify({"res": "wrong password"}), 400
    token = authentication.createToken(name, password)

    data = {'token': token}
    #return do token para o mail_app, verificar return
    return jsonify(data), 200
Ejemplo n.º 4
0
	def render_signup(self, username = '', password = '',
				verify = '', email = '', usernameerror = '',
				passworderror = '', verifyerror = '',
				emailerror = '', redirect = ''):
		current_url = self.request.url
		user = authentication.getUser(self)
		if not redirect:
			redirect = '/welcome'
		p = {}
		for name, uri in providers.items():
			p[name] = users.create_login_url(dest_url=redirect,
				federated_identity=uri)
		self.render('signup.html',
			providers = p, username = username, password = password,
			verify = verify, email = email, usernameerror = usernameerror,
			passworderror = passworderror, verifyerror = verifyerror,
			emailerror = emailerror, redirect = redirect
		)