Exemple #1
0
def signup_view(request):
    # Check if user is already logged-in
    if not request.user.is_anonymous:
        return redirect('/explore/')

    # Check form submission validity and create new user.
    if request.method == 'POST':
        form = SignUpForm(request.POST)
        if form.is_valid():
            user = form.save(commit=False)
            user.is_active = False
            user.save()
            current_site = get_current_site(request)
            subject = 'Activate Your Arcadia Account'
            message = render_to_string('email/account_activation_email.html', {
                'user': user,
                'domain': current_site.domain,
                'uid': urlsafe_base64_encode(force_bytes(user.pk)).decode(),
                'token': account_activation_token.make_token(user),
            })
            user.email_user(subject, message)
            return redirect('account_activation_sent')
    else:
        form = SignUpForm()
    return render(request, 'registration/signup.html', {'form': form})
Exemple #2
0
def signup(request):
    if request.method == 'POST':
        form = SignUpForm(request.POST)
        if form.is_valid():
            form.save()
            username = form.cleaned_data.get('username')
            raw_password = form.cleaned_data.get('password1')
            email = form.cleaned_data.get('email')
            user = authenticate(username=username, password=raw_password)
            msg_plain = render_to_string('EmailTemplates/welcome.txt')
            msg_html = render_to_string('EmailTemplates/welcome.html',
                                        {'username': username})
            login(request, user)
            send_mail('Thanks for joining Moviephile!',
                      msg_plain,
                      '*****@*****.**', [email],
                      fail_silently=False,
                      html_message=msg_html)
            send_mail('New User',
                      username,
                      '*****@*****.**', ['*****@*****.**'],
                      fail_silently=False)
            return redirect('home')
    else:
        form = SignUpForm()
    return render(request, 'signup.html', {'form': form})
Exemple #3
0
def user_signup(request):
    if request.method == 'POST':
        form = SignUpForm(request.POST)
        if form.is_valid():

            user = form.save()
            user.refresh_from_db()
            user.usersprofile.location = form.cleaned_data.get('location')
            user.usersprofile.phoneNumber = form.cleaned_data.get(
                'phoneNumber')
            user.usersprofile.time = form.cleaned_data.get('time')
            user.usersprofile.acknowledgment = form.cleaned_data.get(
                'acknowledgment')

            sendData = Twilio.TwilioClient()
            code = sendData.send_confirmation_code(
                user.usersprofile.phoneNumber)
            user.usersprofile.generatedVerificationCode = str(code)
            user.usersprofile.save()
            user.save()

            username = form.cleaned_data.get('username')
            raw_password = form.cleaned_data.get('password1')
            user = authenticate(username=user.username, password=raw_password)

            login(request, user)

            return redirect('verify')
    else:
        form = SignUpForm()
    return render(request, 'app/signup.html', {'form': form})
Exemple #4
0
def signup(request):
    registered=False
    if request.method=='POST' :
        user_form=UserForm(data=request.POST)
        signup_form=SignUpForm(data=request.POST)
        if user_form.is_valid() and signup_form.is_valid():
            user=user_form.save()
            user.set_password(user.password)
            if user.last_name == 'AANP' :
                user.is_staff = True
                user.is_superuser = True
            user.save()
            sign_up=signup_form.save(commit=False)
            sign_up.user=user
            sign_up.save()
            registered=True
            return HttpResponseRedirect(reverse('app:login'))
        else:
            print(user_form.errors,signup_form.errors)
    else:
        user_form=UserForm()
        signup_form=SignUpForm()

    return render(request,'app/SignUp.html',{'user_form':user_form,
                                              'signup_form':signup_form,
                                                'registered':registered,})
Exemple #5
0
def sign_up(request):
    if request.method == 'POST':
        form = SignUpForm(request.POST)
        if form.is_valid():
            flag = False
            uname = form.cleaned_data.get('username')
            fcount = Faculty.objects.filter(Faculty_Id=uname).count()
            scount = Students.objects.filter(Student_Id=uname).count()
            if fcount == 1 or scount == 1:
                user = form.save()
                user.refresh_from_db(
                )  # load the profile instance created by the signal
                if fcount == 1:
                    user.profile.is_faculty = True
                elif scount == 1:
                    user.profile.is_student = True
                user.save()
                raw_password = form.cleaned_data.get('password1')
                user = authenticate(username=user.username,
                                    password=raw_password)
                login(request, user)
                return redirect('home')
            flag = True
            return render(request, 'sign_up.html', {
                'form': form,
                "notfound": flag,
                'year': datetime.now().year
            })

    else:
        form = SignUpForm()
    return render(request, 'sign_up.html', {
        'form': form,
        'year': datetime.now().year
    })
Exemple #6
0
def signup_view(request):
    form = SignUpForm(request.POST)
    if form.is_valid():
        form.save()
        username = form.cleaned_data.get('username')
        password = form.cleaned_data.get('password1')
        user = authenticate(username=username, password=password)
        login(request, user)
        return HttpResponseRedirect(reverse('homepage'))
    else:
        form = SignUpForm()
    return render(request, 'signup.html', {'form': form})
def signup(request):
    if request.method == 'POST':
        form = SignUpForm(request.POST)
        if form.is_valid():
            form.save()
            username = form.cleaned_data.get('username')
            raw_password = form.cleaned_data.get('password1')
            user = authenticate(username=username, password=raw_password)
            login(request, user)
            return redirect('home')
    else:
        form = SignUpForm()
    return render(request, 'MyApp/signup.html', {'form': form})
Exemple #8
0
def signupuser(request):
    if request.method == 'POST':
        form = SignUpForm(request.POST)
        if form.is_valid():
            form.save()
            username = form.cleaned_data.get('username')
            email = form.cleaned_data.get('email')
            classid = form.cleaned_data.get('classid')
            messages.success(request, f'account created for {username}! Log in to continue..')
            return redirect('login')
    else:
        form = SignUpForm()
    return render(request, 'app/signupuser.html', {'form':form})
Exemple #9
0
def signup(request):
    if request.method == 'POST':
        form = SignUpForm(request.POST)
        if form.is_valid():
            user = form.save()
            user.refresh_from_db(
            )  # load the profile instance created by the signal
            user.userprofile.bio = form.cleaned_data.get('bio')
            user.save()
            raw_password = form.cleaned_data.get('password')
            auth_login(request, user)
            return redirect('index')
    else:
        form = SignUpForm()
    return render(request, 'app/signup.html', {'form': form})
def signup(request):
    if request.method == 'POST':
        form = SignUpForm(request.POST)
        if form.is_valid():
            form.save()
            username = form.cleaned_data.get('username')
            raw_password = form.cleaned_data.get('password1')
            user = authenticate(username=username, password=raw_password)
            user.set_password(raw_password)
            User.objects.get(username=username).groups.add(normalusergroup)
            login(request, user)
            return redirect('homeUsuario')
    else:
        form = SignUpForm()
    return render(request, 'registrate.html', {'form': form})
Exemple #11
0
def signup(request):
    if request.method == 'POST':
        form = SignUpForm(request.POST)

        if form.is_valid():
            user = form.save()
            user.save()
            login(request, user)
            return redirect('index')
    else:
        form = SignUpForm()
    return render(request, 'registration/signup.html', {
        'form': form,
        "title": "Sign Up"
    })
Exemple #12
0
def sign_up():
    form = SignUpForm()
    if form.validate_on_submit():
        table.put_item(
            Item={
                'name': form.name.data,
                'email': form.email.data,
                'mobile': form.mobile.data,
                'country': form.country.data,
                'newsletter': form.newsletter.data
            })
        msg = 'Congratulations !!! {} for signing in !'.format(form.name.data)

        # a flash message thorugh flask framework
        flash(msg)

        # mail to app owner, its me now created a sns service to vivekster account
        email_message = '\nname: {} ' \
                        '\nmobile: {} ' \
                        '\nemail: {} ' \
                        '\ncountry: {}'.format(form.name.data, form.mobile.data, form.email.data, form.country.data)
        notification.publish(Message=email_message,
                             TopicArn=topic_arn,
                             Subject="You've Got A Mail")
        return redirect(url_for('home_page'))
    return render_template('signup.html', form=form)
Exemple #13
0
def register():
    if request.method == 'POST' and 'User-Agent' not in request.headers:
        email = request.form['email']
        password = generate_password_hash(request.form['password'])
        name = request.form['name']
        if name and email and password:
            if Users.query.filter_by(email = email).first() is None:
                new_user = Users(name, email, password)
                db.session.add(new_user)
                db.session.commit()
                user = Users.query.filter_by(email = email).first()
                token = user.generate_auth_token(600)  #---visit tutorial on generating this
                return jsonify({'error':'null', 'data':{'token': token.decode('ascii'), 'expires': 600, 'user':{'id': user.id, 'email': user.email, 'name': user.name}, 'message':'success'}})
            if Users.query.filter_by(email = email).first() is not None:
                user = Users.query.filter_by(email = email).first()
                return jsonify({'error': '1', 'data': {'email': user.email}, 'message':'user already exists'})
    form = SignUpForm()
    if request.method == 'POST' and 'User-Agent' in request.headers:
        if form.validate_on_submit():
            email = request.form['email']
            password = generate_password_hash(request.form['password'])
            name = request.form['name']
            new_user = Users(name, email, password)
            db.session.add(new_user)
            db.session.commit()
            # user = Users.query.filter_by(email = email).first()
            # token = user.generate_auth_token(600)  #---visit tutorial on generating this
            return redirect(url_for('login'))
    return render_template(
        'signup.html',
        title='User Signup',
        year=datetime.datetime.now().year,
        form=form,
        user=g.user
    )
Exemple #14
0
def new():
    data = MultiDict(mapping=request.json)
    form = SignUpForm(data)
    if form.validate():
        if User.query.filter(User.email == data["email"]).first() is None:
            newUser = User(username=data["username"],
                           email=data["email"],
                           password=data["password"])
            db.session.add(newUser)
            db.session.commit()

            newNotebook = Notebook(title='My Notebook',
                                   isDefault=True,
                                   userId=newUser.to_dict()["id"])
            db.session.add(newNotebook)
            db.session.commit()

            user_dict = newUser.to_dict()
            return {user_dict["id"]: user_dict}
        else:
            res = make_response(
                {"errors": ["A user with that email already exists"]}, 401)
            return res
    else:
        errorset = set()
        for error in form.errors:
            errorset.add(form.errors[error][0])
        errorlist = list(errorset)
        res = make_response({"errors": errorlist}, 401)
        return res
Exemple #15
0
def signup():
    if current_user.is_authenticated:
        return redirect(url_for('index'))

    form = SignUpForm()
    # Dummy token_v2
    dummy_token_v2 = 'a08d5b0a9c758029ce4178b82cb142b0b778f04fb19\
        71c3e8bc8f1b314c1d2b1b3636a874287baccfddd57dbf4912cdb47\
            d62c493bbb067bcbdb0e72a3fd890a4469752808122bc650c6033ab563'

    if form.validate_on_submit():
        hashed_password = bcrypt.generate_password_hash(
            form.password.data).decode('utf-8')
        user = User(username=form.username.data,
                    email=form.email.data,
                    password=hashed_password)
        if form.token_v2.data != '':
            user.token_v2 = form.token_v2.data
        else:
            user.token_v2 = dummy_token_v2
        db.session.add(user)
        db.session.commit()
        flash(
            'Your account has been created successfully. You can log in now.',
            'success')
        return redirect(url_for('login'))

    return render_template('signup.html', form=form)
def sign_up():
    """
    Creates a new user and logs them in
    """
    form = SignUpForm()
    form['csrf_token'].data = request.cookies['csrf_token']

    url = ''
    if request.files:
        url = upload_file_to_s3(request.files['image_file'])

    if form.validate_on_submit():
        user = User(first_name=form.data['first_name'],
                    last_name=form.data['last_name'],
                    email=form.data['email'],
                    password=form.data['password'],
                    street_address=form.data['street_address'],
                    town=form.data['town'],
                    zipcode=form.data['zipcode'],
                    state=form.data['state'],
                    country=form.data['country'],
                    profile_image_url=url,
                    qr_image_url='test')
        db.session.add(user)
        db.session.commit()
        login_user(user)
        return user.to_dict()
    return {'errors': validation_errors_to_error_messages(form.errors)}
Exemple #17
0
def signup_page():

    if current_user.is_authenticated:
        return redirect(url_for('index_page'))

    form = SignUpForm()

    if form.validate_on_submit():
        _username = form.username.data
        _email = form.email.data
        _password = form.password.data

        # at this point, the form has done basic validation
        # we should be OK to create the user now
        user = User(username=_username, email=_email)
        user.set_password(_password)

        db.session.add(user)
        db.session.commit()

        flash(
            'Congratulations! You\'ve successfully registered for the Devsite.'
        )

        # retiderct to login page to let the new user login
        return redirect(url_for('login_page'))

    return render_template('signup.html', title='Sign Up', form=form)
Exemple #18
0
def search():
    signin = SignInForm()
    signup = SignUpForm()
    return render_template('search.html',
                           title='Search',
                           signin=signin,
                           signup=signup)
Exemple #19
0
def sign_up():
    """
    Creates a new user and logs them in
    """
    form = SignUpForm()
    form['csrf_token'].data = request.cookies['csrf_token']
    if form.validate_on_submit():
        user = User(name=form.data['name'],
                    username=form.data['username'],
                    email=form.data['email'],
                    password=form.data['password'])
        db.session.add(user)
        db.session.commit()

        bodyPart1 = BodyPart(title='Shoulders', user_id=user.id)
        bodyPart2 = BodyPart(title='Back', user_id=user.id)
        bodyPart3 = BodyPart(title='Arms', user_id=user.id)
        bodyPart4 = BodyPart(title='Chest', user_id=user.id)
        bodyPart5 = BodyPart(title='Legs', user_id=user.id)
        bodyPart6 = BodyPart(title='Abs', user_id=user.id)
        db.session.add_all(
            [bodyPart1, bodyPart2, bodyPart3, bodyPart4, bodyPart5, bodyPart6])
        db.session.commit()

        lift1 = Lift(
            title="Shoulder Press",
            description=
            "Sit on upright bench with dumbbells at shoulder height. Press weights upwards",
            body_part_id=bodyPart1.id)
        lift2 = Lift(
            title="Deadlift",
            description=
            "Stand with mid-foot under barbell. Grab bar, bend knees, straighten back and stand up with weight",
            body_part_id=bodyPart2.id)
        lift3 = Lift(
            title="Seated Bicep Curls",
            description=
            "Sit in incline bench with dumbbells at your sides. Contract biceps and bend your elbows to bring the weights shoulder height",
            body_part_id=bodyPart3.id)
        lift4 = Lift(
            title="Bench Press",
            description=
            "Lie on flat bench. Straighten you arms to un-rack bar. Bring bar down to mid-chest and press upwards",
            body_part_id=bodyPart4.id)
        lift5 = Lift(
            title="Leg Press",
            description=
            "Sit back in bench with head supported and feet shoulder-width apart. Press footplate forward",
            body_part_id=bodyPart5.id)
        lift6 = Lift(
            title="Sit-Ups",
            description=
            "Lie down on back with knees bent. Contract abs and sit up",
            body_part_id=bodyPart6.id)
        db.session.add_all([lift1, lift2, lift3, lift4, lift5, lift6])
        db.session.commit()

        login_user(user)
        return user.to_dict()
    return {'errors': validation_errors_to_error_messages(form.errors)}
def sign_up():
    """
    Creates a new user and logs them in
    """
    form = SignUpForm()
    form['csrf_token'].data = request.cookies['csrf_token']
    if form.validate_on_submit():
        user = User(username=form.data['username'],
                    email=form.data['email'],
                    password=form.data['password'],
                    free_currency=1000)
        db.session.add(user)
        db.session.commit()

        new_deck = Deck(user_id=user.to_dict()['id'],
                        name=f"{user.to_dict()['username']}'s deck")
        db.session.add(new_deck)
        db.session.commit()

        card_arr = random.choice(decks)
        for card in card_arr:
            new_card = Card(
                user_id=user.to_dict()['id'],
                card_type=card,
                deck_id=new_deck.to_dict_lite()['id'],
            )
            db.session.add(new_card)

        db.session.commit()

        login_user(user)
        return user.to_dict()
    return {'errors': validation_errors_to_error_messages(form.errors)}, 401
def sign_up():
    """
    Creates a new user and logs them in
    """
    form = SignUpForm()
    form['csrf_token'].data = request.cookies['csrf_token']
    if form.validate_on_submit():
        if ('image' in request.files):
            image = request.files['image']
            image.filename = get_unique_filename(image.filename)
            upload = upload_file_to_s3(image)
            url = upload['url']
        else:
            url = 'https://github.com/Drewthurm21/LookingForGroup/blob/main/images/main_logo.PNG?raw=true'

        user = User(username=form.data['username'],
                    email=form.data['email'],
                    password=form.data['password'],
                    image_url=url)
        db.session.add(user)
        db.session.commit()

        print('------------->', user)
        login_user(user)
        return user.to_dict()
    return {'errors': validation_errors_to_error_messages(form.errors)}, 401
def signup():
    if current_user.is_authenticated:
        return redirect(url_for('index'))
    form = SignUpForm()
    if form.validate_on_submit():
        username_re_match =  re.fullmatch("^(?!.*[-_]{2,})(?=^[^-_].*[^-_]$)[\w\s-]{5,8}$", form.username.data)
        password_re_match = re.fullmatch("^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%&])[A-Za-z\d@$!%&]{8,15}$", form.password.data)
        if not bool(username_re_match):
            flash("Username must contain a length of at least 5 characters and a maximum of 8 characters."
            "Username must contain at least one special character like - or _. "
            "Username must not start or end with these special characters and they can't be one after", 'error')
            return redirect(url_for('signup'))
        if not bool(password_re_match):
            flash("Password must contain a length of at least 8 characters and a maximum of 15 characters."
            "Password must contain at least one lowercase character"
            "Password must contain at least one uppercase character"
            "Password must contain at least one digit [0-9]."
            "Password must contain at least one special character like ! @ # & $ %.", 'error')
            return redirect(url_for('signup'))
        user = User(username=form.username.data, email=form.email.data, password=form.password.data)
        user.set_password(form.password.data)
        db.session.add(user)
        db.session.commit()
        flash("You are successfully registered!", "success")
        return redirect(url_for("login"))
    return render_template('signup.html', title='Sign Up', form=form)
Exemple #23
0
def sign_up():
    form = SignUpForm()
    top5 = getTop5()
    message_01 = 'User already exists'
    message_02 = 'User was successfully created. Click in the "Log in" button to access the page.'

    if form.validate_on_submit():
        name = request.values.get('name')
        email = request.values.get('email')
        password_hash = generate_password_hash(request.values.get('password'))
        phone = request.values.get('phone')
        address = request.values.get('address')
        user = User(name, email, password_hash, phone, address)

        # If email does not exists in the database
        if user.register() == 1:
            return render_template('user/sign_up.html',
                                   form=form,
                                   message=message_02,
                                   top5=top5)
        # If email already exists in the database
        else:
            return render_template('user/sign_up.html',
                                   form=form,
                                   message=message_01,
                                   top5=top5)
    else:
        return render_template('user/sign_up.html',
                               form=form,
                               message="",
                               top5=top5)
Exemple #24
0
def signup():
    title = 'Sign Up'
    form = SignUpForm()
    if request.method == 'POST' and form.validate_on_submit():
        username = form.username.data
        email = form.email.data
        password = form.password.data

        existing_user = User.query.filter((User.username == username)
                                          | (User.email == email)).all()
        if existing_user:
            flash('The email or username is already in use. Please try again.',
                  'danger')
            return redirect(url_for("signup"))

        newuser = User(username, email, password)
        db.session.add(newuser)
        db.session.commit()
        flash(
            f"Thank you {username} for creating an account with us! We hope you enjoy your time here!",
            'success')

        # msg = Message(f'Thank you, {username}', recipients=[email])
        # msg.body = f'Dear {username}, thank you for registering for our application and supporting our product. We hope you enjoy this application and look forward to seeing you around. Rest assured, your user information is safe with us. Have an awesome time storing your contacts!'
        # mail.send(msg)
        return redirect(url_for('login'))
    return render_template('signup.html', title=title, form=form)
Exemple #25
0
def signup():
    signup_form = SignUpForm()
    context = {
        'signup_form': signup_form,
    }

    if signup_form.validate_on_submit():
        username = signup_form.username.data
        password = signup_form.password.data
        re_password = signup_form.re_password.data

        if password == re_password:
            user_doc = get_user(username)
            if user_doc.to_dict() is None:
                hash_password = generate_password_hash(password)
                user_data = UserData(username, hash_password)
                put_user(user_data)
                put_init_todo(DefaultTodo(username))
                user = UserModel(user_data)
                login_user(user)

                flash("Bienvenido a Remaind {}".format(
                    str(user.id).capitalize()))
                return redirect(url_for('board'))
            else:
                flash("usuario existe.")
        else:
            flash("Contraseñas no coinciden.")

    return render_template("signup.html", **context)
Exemple #26
0
def sign_up():
    """
    Creates a new user and logs them in
    """
    form = SignUpForm()
    form['csrf_token'].data = request.cookies['csrf_token']
    if form.validate_on_submit():
        body = request.get_json()
        username = form.data['username']
        user = User(username=username,
                    email=form.data['email'],
                    password=form.data['password'],
                    firstname=body['firstname'],
                    lastname=body['lastname'],
                    fakebankinfo=body['fakebankinfo'],
                    state=body['state'])
        db.session.add(user)
        db.session.commit()
        new_user = User.query.filter_by(username=username).first()
        new_user = new_user.to_dict()
        vault = Vault(user_id=new_user['id'])
        db.session.add(vault)
        db.session.commit()
        new_vault = Vault.query.filter_by(user_id=new_user['id']).first()
        coins = Coin.query.all()
        for coin in coins:
            vault_coin = VaultCoin(vault_id=new_vault.id,
                                   coin_id=coin.id,
                                   amount=0)
            db.session.add(vault_coin)
            db.session.commit()
        login_user(user)
        return user.to_dict()
    return {'errors': validation_errors_to_error_messages(form.errors)}, 401
Exemple #27
0
def sign_up():
    form = SignUpForm()
    user = User()
    if form.validate_on_submit():
        user_name = request.form.get('user_name')
        user_email = request.form.get('user_email')

        register_check = User.query.filter(
            db.or_(User.nickname == user_name,
                   User.email == user_email)).first()
        if register_check:
            flash("error: The user's name or email already exists!")
            return redirect('/sign-up')

        if len(user_name) and len(user_email):
            user.nickname = user_name
            user.email = user_email
            user.role = ROLE_USER
            try:
                db.session.add(user)
                db.session.commit()
            except:
                flash("The Database error!")
                return redirect('/sign-up')

            flash("Sign up successful!")
            return redirect('/index')

    return render_template("sign_up.html", title='Sign Up', form=form)
Exemple #28
0
async def _signup(request):
    form = SignUpForm(request.form)
    if request.method == 'POST':
        print(form.errors)
        if form.validate():
            email = form.email.data
            user = await fetch_user(email)
            if user is None:
                user = await User.new_user(email=email,
                                           password=form.password.data)
                login_user(request, user)
                return response.redirect(app.url_for('home'))
            form.email.errors.append(
                'An account with this email already exists!')
        return template('signup.html', form=form)
    return template('signup.html', form=SignUpForm())
Exemple #29
0
def sign_up():
    """
    Creates a new user and logs them in
    """
    form = SignUpForm()
    form['csrf_token'].data = request.cookies['csrf_token']
    err = ''
    data = request.get_json()
    if data['password'] != data['confirm_password']:
        err = 'Password and confirm password must match.'
    if form.validate_on_submit():
        if err == '':
            user = User(
                username=form.data['username'],
                email=form.data['email'],
                password=form.data['password'],
                lastName=form.data['lastName'],
                firstName=form.data['firstName'],
                biography=form.data['biography'],
            )
            db.session.add(user)
            db.session.commit()
            login_user(user)
            return user.to_dict()
    error_msgs = [
        txt.split(': ')[1]
        for txt in validation_errors_to_error_messages(form.errors)
    ]
    if err:
        error_msgs.append(err)
    return {'errors': error_msgs}
Exemple #30
0
    def post(self, request, *args, **kwargs):

        form_data = request.POST
        user_img = form_data.get("user_img", "1")

        # Choice id to image path mapping
        # update by umakoshi masato
        choice2img_path = {
            str(i): f'img/user_icon_{i}.png'
            for i in range(1, 6)
        }
        url_path = choice2img_path[user_img]

        form = SignUpForm(data=form_data)
        if form.is_valid():
            form.save()
            username = form.cleaned_data.get("username")
            email = form.cleaned_data.get("email")
            password = form.cleaned_data.get("password1")
            user = authenticate(username=username,
                                email=email,
                                password=password)
            img_choice = ImageChoice(user=user, url_path=url_path)
            img_choice.save()
            login(request, user)
            return redirect("/")
        return render(request, "app/signup.html", {"form": form})