Esempio n. 1
0
 def access_data_user(user_data):
     user_data['avatar'] = user_data['profile']['avatarUrl']
     user_data['uid'] = user_data['account']['id']
     user_data['username'] = user_data['profile']['nickname']
     user = UserModel(user_data).get_dict()
     user['code'] = 200
     return user
Esempio n. 2
0
def sign_up_view(request):
    if request.method == "GET":
        form = CreateUserForm()
        context = {'form': form}
        return render(request, 'sign_up.html', context)
    else:
        form = CreateUserForm(request.POST)
        if form.is_valid():
            user = form.save()
            user_created = User.objects.get(pk=user.id)
            UserModel(user=user_created,
                      first_name=user.first_name,
                      last_name=user.last_name).save()
            messages.success(request, f'Account created successfully')

            return redirect('sign_in')

        context = {'errors': form.errors, 'form': CreateUserForm()}

        return render(request, 'sign_up.html', context)
Esempio n. 3
0
def access_user(user_data):
    user_data['avatar'] = user_data['profile']['avatarUrl']
    user_data['uid'] = user_data['account']['id']
    user_data['username'] = user_data['profile']['nickname']
    user = UserModel(user_data).get_model()
    return user