Beispiel #1
0
def register_post(request: Request):
    print(f'POST: {request.POST}')
    email = request.POST.get('email')
    name = request.POST.get('name')
    password = request.POST.get('password')

    if not email or not name or not password:
        error = "Some required field are missing"
        return {
            'name': name,
            'email': email,
            'password': password,
            'error': error
        }

    # create user
    user_service.create_user(request.dbsession, name, email, password)
    return HTTPFound(location='/account')
def register_post(request: Request):
    vm = RegisterViewModel(request)
    vm.validate()

    if vm.error:
        return vm.to_dict()

    # create user
    user = user_service.create_user(vm.email, vm.name, vm.password)
    cookie_auth.set_auth(request, user.id)

    return x.HTTPFound('/account')
Beispiel #3
0
def register_post(request: Request):
    email = request.POST.get('email')
    name = request.POST.get('name')
    password = request.POST.get('password')

    if not email or not name or not password:
        return {
            'email': email,
            'name': name,
            'password': password,
            'error': 'Some required fields are missing'}

    # create user
    user = user_service.create_user(email, name, password)
    cookie_auth.set_auth(request, user.id)

    return x.HTTPFound('/account')