Repository: CiviWiki/OpenCiviWiki

Issue:
Move forms from `api/forms.py` to the `accounts/forms.py`
## Idea summary

There are several account/profile forms defined in [`api/forms.py`](https://github.com/CiviWiki/OpenCiviWiki/blob/develop/project/api/forms.py). Those forms should be moved to [`accounts/forms.py`](https://github.com/CiviWiki/OpenCiviWiki/blob/develop/project/accounts/forms.py) or deleted if they are duplicate code.

**Update:** the code in `api/forms.py` is actually redundant, so may simply be deleted.

## Task

The steps to complete this task are:

- [x] [fork this repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo) and clone it to your local computer
- [x] set up a local development environment as [outlined in our Contributing Guide](https://github.com/CiviWiki/OpenCiviWiki/blob/develop/CONTRIBUTING.md#development)
- [x] delete the file `api/forms.py`
- [x] commit your changes
- [x] push your code to GitHub
- [x] [open a pull request](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request) against the `main` branch in this repository


Discussion:
I want to contribute and resolve this issue. 
Please guide me in this how I proceed to fix bug
Thanks, @anurag629  ! I'll assign you.

I've added steps to complete this issue in the description above, under the "Task" section.

I'm not sure of your familiarity with all of those steps, so I may have included steps that are obvious. In any case, feel free to ask for assistance with any questions or ideas.
after cloning, I have to delete the file named 'forms.py'  OpenCiviWiki\project\api\forms.py.
Kindly check the path.

Thank You!
Go shead and commit your changes and open a pull request. That way it will be easier for me to review.

Resolving patch:
diff --git a/project/api/forms.py b/project/api/forms.py
deleted file mode 100644
--- a/project/api/forms.py
+++ /dev/null
@@ -1,101 +0,0 @@
-from django import forms
-from django.core.files.images import get_image_dimensions
-from django.contrib.auth import get_user_model
-from accounts.models import Profile
-
-
-class UpdatePassword(forms.ModelForm):
-    """
-    Form for updating User Password
-    """
-
-    class Meta:
-        model = get_user_model()
-        fields = ["password", "verify"]
-
-    password = forms.CharField(
-        label="Password",
-        widget=forms.PasswordInput(
-            attrs={
-                "class": "form-control",
-                "placeholder": "Password",
-                "required": "True",
-            }
-        ),
-    )
-    verify = forms.CharField(
-        label="Password Verify",
-        widget=forms.PasswordInput(
-            attrs={
-                "class": "form-control",
-                "placeholder": "Password Verify",
-                "required": "True",
-            }
-        ),
-        help_text="Please retype your password.",
-    )
-
-    def clean(self):
-        """
-        Verifies that the passwords match
-        """
-        clean_data = super(UpdatePassword, self).clean()
-        if "password" in clean_data and "verify" in clean_data:
-            if clean_data["password"] != clean_data["verify"]:
-                raise forms.ValidationError("Passwords don't match.")
-        else:
-            raise forms.ValidationError("Both password fields need to be filled out.")
-        return clean_data
-
-
-class UpdateProfileImage(forms.ModelForm):
-    """
-    Form for updating profile image
-    """
-
-    class Meta:
-        model = Profile
-        fields = ["profile_image"]
-
-    profile_image = forms.ImageField()
-
-    def clean_profile_image(self):
-        """
-        This function is used to make sure that profile images follow Civiwiki standards.
-
-        Requirements:
-            - Height cannot exceed 960px
-            - Width cannot exceed 1280px
-            - Image must be (jpg, jpeg, pjeg, png)
-            - File size cannot exceed 2MB
-        """
-        profile_image = self.cleaned_data["profile_image"]
-
-        try:
-            w, h = get_image_dimensions(profile_image)
-
-            # validate dimensions
-            max_height = 960
-            max_width = 1280
-            if w > max_width or h > max_height:
-                raise forms.ValidationError(
-                    u"Please use an image that is {w} x {h} pixels or smaller.".format(
-                        w=max_width, h=max_height
-                    )
-                )
-
-            # validate content type
-            main, sub = profile_image.content_type.split("/")
-            if not (main == "image" and sub in ["jpg", "jpeg", "pjpeg", "png"]):
-                raise forms.ValidationError(u"Please use a JPEG or PNG image.")
-
-            # validate file size
-            if len(profile_image) > (2000 * 1024):
-                raise forms.ValidationError(
-                    "Profile image file size may not exceed 2MB."
-                )
-
-        except AttributeError:
-            pass
-
-        return profile_image


Test patch: