summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-06-20 06:56:11 +0000
committerCoprDistGit <infra@openeuler.org>2023-06-20 06:56:11 +0000
commit007a04094dc5405e2ad99d5190fa6a075fc73389 (patch)
treec403e67533b28c4a687076f1c8ec39c28879b614
parent3660caebe43c5763f9b030ee42676f151c9ac6a3 (diff)
automatic import of python-django-rest-sms-authopeneuler20.03
-rw-r--r--.gitignore1
-rw-r--r--python-django-rest-sms-auth.spec452
-rw-r--r--sources1
3 files changed, 454 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..53f4b7f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/django-rest-sms-auth-0.1.22.tar.gz
diff --git a/python-django-rest-sms-auth.spec b/python-django-rest-sms-auth.spec
new file mode 100644
index 0000000..317c2e3
--- /dev/null
+++ b/python-django-rest-sms-auth.spec
@@ -0,0 +1,452 @@
+%global _empty_manifest_terminate_build 0
+Name: python-django-rest-sms-auth
+Version: 0.1.22
+Release: 1
+Summary: Django users authentication through SMS code
+License: MIT
+URL: https://github.com/a1k89/django-rest-sms-auth
+Source0: https://mirrors.aliyun.com/pypi/web/packages/b1/1b/983f7720bbf320bb85dd0d9a0211a70cbf7c8f29fd5bff6dd93101378aa0/django-rest-sms-auth-0.1.22.tar.gz
+BuildArch: noarch
+
+Requires: python3-Django
+Requires: python3-djangorestframework
+Requires: python3-phonenumbers
+Requires: python3-django-phonenumber-field
+Requires: python3-celery
+
+%description
+# Django rest sms auth
+
+* Authentication users
+* Change phone number
+* Providers:
+ * Megafon
+ * Smsaero
+ * Twilio
+
+### Requirements
++ Python >= 3.0
++ Django >= 2.0
++ Celery
++ Djangorestframework
++ Django-phonenumber-field
+
+### Concept
+1. Client send phone number
+2. `smsauth` validate and create `sms code`
+3. `sms provider` send digit code
+4. Client send `{sms code + phone number}`
+5. Response info (`jwt token`)
+
+### Notes
+* Library use `celery`. [Instruction](https://github.com/a1k89/blog/wiki/Make-django-asynchronous-through-celery)
+* To use `twilio` install [extra library](https://www.twilio.com/docs/libraries/python)
+* You may add your own provider inherit from `SMSProvider`
+
+### Installation
+```commandline
+pip install django-rest-sms-auth
+```
+If you want to use `twilio`:
+```commandline
+pip install twilio
+```
+
+`settings.py`
+
+```python
+INSTALLED_APPS = [
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ ...
+ 'sms_auth', # you have to add this
+ 'sms_auth.providers.twilio' # if twilio provider
+ 'sms_auth.providers.megafon' # if megafon provider
+]
+
+SMS_AUTH_SETTINGS = {
+ "SMS_CELERY_FILE_NAME": "run_celery", # your system celery file,
+ "SMS_AUTH_SUCCESS_KEY": "jwt_token", # property from user model
+ "SMS_AUTH_PROVIDER_FROM": "ex: +7542222222", # sms signature
+
+ # If twilio
+ "SMS_AUTH_ACCOUNT_SID": "Twilio SID"
+ "SMS_AUTH_AUTH_TOKEN": "Twilio token"
+
+ # If another provider
+ "SMS_AUTH_PROVIDER_LOGIN":"SMS provider login"
+ "SMS_AUTH_PROVIDER_PASSWORD": "SMS provider password"
+}
+```
+
+Add `celery` configuration file: [Instruction](https://github.com/a1k89/blog/wiki/Make-django-asynchronous-through-celery)
+
+run migrations:
+```python
+python manage.py makemigrations sms_auth && python manage.py migrate
+```
+`urls.py`
+```python
+path('auth/', include('sms_auth.api.urls'))
+```
+
+Library is ready to use.
+
+### Usage
+1. Sign-in / sign-up:
+```command
+POST /auth/sign-in/
+body: {
+ "phone_number":"user phone number"
+}
+result: 200/400 response
+```
+2. Code validation and get token:
+```command
+POST /auth/auth/
+body: {
+ "phone_number":"user phone number",
+ "code":sms_code
+}
+result: 200/400 response (with token)
+```
+
+3. Change phone number:
+```command
+POST /auth/change-phonenumber/
+body: {
+ "new_phone_number":"user new phone number"
+}
+result: 200/400 response
+```
+After your call previous endpoint: `/auth/auth` and send new phone number with code.
+
+
+### Extra
+To clear all expired sms codes
+```python
+python manage.py clear_expired
+```
+Additional settings:
+```
+"SMS_AUTH_CODE_LEN": int (default: 4)
+"SMS_DEBUG": bool (default: False)
+"SMS_DEBUG_CODE": int (when debug, default 1111)
+"SMS_USER_FIELD": "username"
+"SMS_TIMELIFE": 60 # life time of each sms code
+"SMS_CODE_NOT_FOUND": "Some text when code not found"
+"SMS_WAIT_TIME": "Some text when sms was sended"
+"SMS_REQUEST_SUCCESS": "Some text when success phone validatioin and sms sended to user",
+"SMS_AUTH_DEBUG_PHONE_NUMBER": phone number with always SMS_DEBUG_CODE
+```
+
+
+
+%package -n python3-django-rest-sms-auth
+Summary: Django users authentication through SMS code
+Provides: python-django-rest-sms-auth
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-django-rest-sms-auth
+# Django rest sms auth
+
+* Authentication users
+* Change phone number
+* Providers:
+ * Megafon
+ * Smsaero
+ * Twilio
+
+### Requirements
++ Python >= 3.0
++ Django >= 2.0
++ Celery
++ Djangorestframework
++ Django-phonenumber-field
+
+### Concept
+1. Client send phone number
+2. `smsauth` validate and create `sms code`
+3. `sms provider` send digit code
+4. Client send `{sms code + phone number}`
+5. Response info (`jwt token`)
+
+### Notes
+* Library use `celery`. [Instruction](https://github.com/a1k89/blog/wiki/Make-django-asynchronous-through-celery)
+* To use `twilio` install [extra library](https://www.twilio.com/docs/libraries/python)
+* You may add your own provider inherit from `SMSProvider`
+
+### Installation
+```commandline
+pip install django-rest-sms-auth
+```
+If you want to use `twilio`:
+```commandline
+pip install twilio
+```
+
+`settings.py`
+
+```python
+INSTALLED_APPS = [
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ ...
+ 'sms_auth', # you have to add this
+ 'sms_auth.providers.twilio' # if twilio provider
+ 'sms_auth.providers.megafon' # if megafon provider
+]
+
+SMS_AUTH_SETTINGS = {
+ "SMS_CELERY_FILE_NAME": "run_celery", # your system celery file,
+ "SMS_AUTH_SUCCESS_KEY": "jwt_token", # property from user model
+ "SMS_AUTH_PROVIDER_FROM": "ex: +7542222222", # sms signature
+
+ # If twilio
+ "SMS_AUTH_ACCOUNT_SID": "Twilio SID"
+ "SMS_AUTH_AUTH_TOKEN": "Twilio token"
+
+ # If another provider
+ "SMS_AUTH_PROVIDER_LOGIN":"SMS provider login"
+ "SMS_AUTH_PROVIDER_PASSWORD": "SMS provider password"
+}
+```
+
+Add `celery` configuration file: [Instruction](https://github.com/a1k89/blog/wiki/Make-django-asynchronous-through-celery)
+
+run migrations:
+```python
+python manage.py makemigrations sms_auth && python manage.py migrate
+```
+`urls.py`
+```python
+path('auth/', include('sms_auth.api.urls'))
+```
+
+Library is ready to use.
+
+### Usage
+1. Sign-in / sign-up:
+```command
+POST /auth/sign-in/
+body: {
+ "phone_number":"user phone number"
+}
+result: 200/400 response
+```
+2. Code validation and get token:
+```command
+POST /auth/auth/
+body: {
+ "phone_number":"user phone number",
+ "code":sms_code
+}
+result: 200/400 response (with token)
+```
+
+3. Change phone number:
+```command
+POST /auth/change-phonenumber/
+body: {
+ "new_phone_number":"user new phone number"
+}
+result: 200/400 response
+```
+After your call previous endpoint: `/auth/auth` and send new phone number with code.
+
+
+### Extra
+To clear all expired sms codes
+```python
+python manage.py clear_expired
+```
+Additional settings:
+```
+"SMS_AUTH_CODE_LEN": int (default: 4)
+"SMS_DEBUG": bool (default: False)
+"SMS_DEBUG_CODE": int (when debug, default 1111)
+"SMS_USER_FIELD": "username"
+"SMS_TIMELIFE": 60 # life time of each sms code
+"SMS_CODE_NOT_FOUND": "Some text when code not found"
+"SMS_WAIT_TIME": "Some text when sms was sended"
+"SMS_REQUEST_SUCCESS": "Some text when success phone validatioin and sms sended to user",
+"SMS_AUTH_DEBUG_PHONE_NUMBER": phone number with always SMS_DEBUG_CODE
+```
+
+
+
+%package help
+Summary: Development documents and examples for django-rest-sms-auth
+Provides: python3-django-rest-sms-auth-doc
+%description help
+# Django rest sms auth
+
+* Authentication users
+* Change phone number
+* Providers:
+ * Megafon
+ * Smsaero
+ * Twilio
+
+### Requirements
++ Python >= 3.0
++ Django >= 2.0
++ Celery
++ Djangorestframework
++ Django-phonenumber-field
+
+### Concept
+1. Client send phone number
+2. `smsauth` validate and create `sms code`
+3. `sms provider` send digit code
+4. Client send `{sms code + phone number}`
+5. Response info (`jwt token`)
+
+### Notes
+* Library use `celery`. [Instruction](https://github.com/a1k89/blog/wiki/Make-django-asynchronous-through-celery)
+* To use `twilio` install [extra library](https://www.twilio.com/docs/libraries/python)
+* You may add your own provider inherit from `SMSProvider`
+
+### Installation
+```commandline
+pip install django-rest-sms-auth
+```
+If you want to use `twilio`:
+```commandline
+pip install twilio
+```
+
+`settings.py`
+
+```python
+INSTALLED_APPS = [
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ ...
+ 'sms_auth', # you have to add this
+ 'sms_auth.providers.twilio' # if twilio provider
+ 'sms_auth.providers.megafon' # if megafon provider
+]
+
+SMS_AUTH_SETTINGS = {
+ "SMS_CELERY_FILE_NAME": "run_celery", # your system celery file,
+ "SMS_AUTH_SUCCESS_KEY": "jwt_token", # property from user model
+ "SMS_AUTH_PROVIDER_FROM": "ex: +7542222222", # sms signature
+
+ # If twilio
+ "SMS_AUTH_ACCOUNT_SID": "Twilio SID"
+ "SMS_AUTH_AUTH_TOKEN": "Twilio token"
+
+ # If another provider
+ "SMS_AUTH_PROVIDER_LOGIN":"SMS provider login"
+ "SMS_AUTH_PROVIDER_PASSWORD": "SMS provider password"
+}
+```
+
+Add `celery` configuration file: [Instruction](https://github.com/a1k89/blog/wiki/Make-django-asynchronous-through-celery)
+
+run migrations:
+```python
+python manage.py makemigrations sms_auth && python manage.py migrate
+```
+`urls.py`
+```python
+path('auth/', include('sms_auth.api.urls'))
+```
+
+Library is ready to use.
+
+### Usage
+1. Sign-in / sign-up:
+```command
+POST /auth/sign-in/
+body: {
+ "phone_number":"user phone number"
+}
+result: 200/400 response
+```
+2. Code validation and get token:
+```command
+POST /auth/auth/
+body: {
+ "phone_number":"user phone number",
+ "code":sms_code
+}
+result: 200/400 response (with token)
+```
+
+3. Change phone number:
+```command
+POST /auth/change-phonenumber/
+body: {
+ "new_phone_number":"user new phone number"
+}
+result: 200/400 response
+```
+After your call previous endpoint: `/auth/auth` and send new phone number with code.
+
+
+### Extra
+To clear all expired sms codes
+```python
+python manage.py clear_expired
+```
+Additional settings:
+```
+"SMS_AUTH_CODE_LEN": int (default: 4)
+"SMS_DEBUG": bool (default: False)
+"SMS_DEBUG_CODE": int (when debug, default 1111)
+"SMS_USER_FIELD": "username"
+"SMS_TIMELIFE": 60 # life time of each sms code
+"SMS_CODE_NOT_FOUND": "Some text when code not found"
+"SMS_WAIT_TIME": "Some text when sms was sended"
+"SMS_REQUEST_SUCCESS": "Some text when success phone validatioin and sms sended to user",
+"SMS_AUTH_DEBUG_PHONE_NUMBER": phone number with always SMS_DEBUG_CODE
+```
+
+
+
+%prep
+%autosetup -n django-rest-sms-auth-0.1.22
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-django-rest-sms-auth -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.22-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..4394226
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+13d9b4ff0774102c3bfcacef03e7a57b django-rest-sms-auth-0.1.22.tar.gz