Esempio n. 1
0
def creatUser():
    """ Create new based on session data, returns the new user id"""
    print "----------------> AKI1.2"
    newUser = db.createUser(name=session.get('username'),
                            email=session.get('email'),
                            picture=session.get('picture'))
    return newUser.id
Esempio n. 2
0
def showSignup():

    if request.method == 'POST':

        data = jsonHandler.loadsJSON(request.data)
        email = validateEmail(data["email"])

        if validateStateToke(data["token"]):
            if not userData.getUserID(email) and email:
                name = data["name"]
                password = saltAndHashed(data["password"])

                if db.createUser(name=name, email=email, password=password):
                    # Register successfully performed
                    return response.builder('Register successfully performed',
                                            200)

                return response.builder(
                    'Error creating the user, please try again later.', 401)

            return response.builder(
                'The user is already registered or entered data are wrong.',
                401)
        return response.builder('Invalid state parameter.', 401)
    else:
        return render_template('signUp.html', token=antiForgeryGenToke())
Esempio n. 3
0
def showSignup():

    if request.method == 'POST':

        data = jsonHandler.loadsJSON(request.data)
        email = validateEmail( data["email"] )

        if validateStateToke( data["token"] ):
            if not userData.getUserID( email ) and email:
                name = data["name"]
                password = saltAndHashed( data["password"] )

                if db.createUser(name = name,
                    email = email,password = password):
                    # Register successfully performed
                    return response.builder( 'Register successfully performed', 200 )
                
                return response.builder( 'Error creating the user, please try again later.', 401 )
            
            return response.builder( 'The user is already registered or entered data are wrong.', 401 )
        return response.builder( 'Invalid state parameter.', 401 )
    else:
        return render_template( 'signUp.html', token = antiForgeryGenToke() )
Esempio n. 4
0
def creatUser():
    """ Create new based on session data, returns the new user id"""
    print "----------------> AKI1.2"
    newUser = db.createUser( name = session.get('username'), 
        email = session.get('email'), picture = session.get('picture') )
    return newUser.id