Skip to content

Commit

Permalink
Added user_registered signal (cvat-ai#5007)
Browse files Browse the repository at this point in the history
  • Loading branch information
azhavoro authored Oct 14, 2022
1 parent 59c0cd4 commit 570bc38
Show file tree
Hide file tree
Showing 18 changed files with 26 additions and 275 deletions.
12 changes: 9 additions & 3 deletions cvat-core/src/server-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,20 @@ class ServerProxy {
const { backendAPI } = config;
let response = null;
try {
response = await Axios.get(`${backendAPI}/restrictions/user-agreements`, {
response = await Axios.get(`${backendAPI}/user-agreements`, {
proxy: config.proxy,
validateStatus: (status) => status === 200 || status === 404,
});

if (response.status === 200) {
return response.data;
}

return [];
} catch (errorData) {

throw generateError(errorData);
}

return response.data;
}

async function register(username, firstName, lastName, email, password1, password2, confirmations) {
Expand Down
12 changes: 7 additions & 5 deletions cvat-ui/src/components/register-page/register-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const validateAgreement: ((userAgreements: UserAgreement[]) => RuleRender) = (
const [agreement] = userAgreements
.filter((userAgreement: UserAgreement): boolean => userAgreement.name === name);
if (agreement.required && !value) {
return Promise.reject(new Error(`You must accept ${agreement.displayText} to continue!`));
return Promise.reject(new Error(`You must accept ${agreement.urlDisplayText} to continue!`));
}

return Promise.resolve();
Expand Down Expand Up @@ -252,10 +252,12 @@ function RegisterFormComponent(props: Props): JSX.Element {
]}
>
<Checkbox>
I read and accept the
<a rel='noopener noreferrer' target='_blank' href={userAgreement.url}>
{` ${userAgreement.displayText}`}
</a>
{userAgreement.textPrefix}
{!!userAgreement.url &&
<a rel='noopener noreferrer' target='_blank' href={userAgreement.url}>
{` ${userAgreement.urlDisplayText}`}
</a>
}
</Checkbox>
</Form.Item>
))}
Expand Down
3 changes: 2 additions & 1 deletion cvat-ui/src/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,9 @@ export interface AboutState {

export interface UserAgreement {
name: string;
displayText: string;
urlDisplayText: string;
url: string;
textPrefix: string;
required: boolean;
}

Expand Down
2 changes: 0 additions & 2 deletions cvat/apps/engine/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from django.views.generic import RedirectView
from django.conf import settings
from cvat.apps.restrictions.views import RestrictionsViewSet

from drf_spectacular.views import SpectacularAPIView, SpectacularRedocView, SpectacularSwaggerView

Expand All @@ -21,7 +20,6 @@
router.register('server', views.ServerViewSet, basename='server')
router.register('issues', views.IssueViewSet)
router.register('comments', views.CommentViewSet)
router.register('restrictions', RestrictionsViewSet, basename='restrictions')
router.register('cloudstorages', views.CloudStorageViewSet)

urlpatterns = [
Expand Down
3 changes: 0 additions & 3 deletions cvat/apps/iam/rules/restrictions.csv

This file was deleted.

3 changes: 0 additions & 3 deletions cvat/apps/restrictions/__init__.py

This file was deleted.

10 changes: 0 additions & 10 deletions cvat/apps/restrictions/apps.py

This file was deleted.

43 changes: 0 additions & 43 deletions cvat/apps/restrictions/serializers.py

This file was deleted.

19 changes: 0 additions & 19 deletions cvat/apps/restrictions/templates/restrictions/terms_of_use.html

This file was deleted.

108 changes: 0 additions & 108 deletions cvat/apps/restrictions/tests.py

This file was deleted.

4 changes: 0 additions & 4 deletions cvat/apps/restrictions/urls.py

This file was deleted.

44 changes: 0 additions & 44 deletions cvat/apps/restrictions/views.py

This file was deleted.

8 changes: 1 addition & 7 deletions cvat/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ def add_ssh_keys():
'cvat.apps.organizations',
'cvat.apps.engine',
'cvat.apps.dataset_repo',
'cvat.apps.restrictions',
'cvat.apps.lambda_manager',
'cvat.apps.opencv',
'cvat.apps.webhooks',
Expand Down Expand Up @@ -184,7 +183,7 @@ def add_ssh_keys():
}

REST_AUTH_REGISTER_SERIALIZERS = {
'REGISTER_SERIALIZER': 'cvat.apps.restrictions.serializers.RestrictedRegisterSerializer',
'REGISTER_SERIALIZER': 'cvat.apps.iam.serializers.RegisterSerializerEx',
}

REST_AUTH_SERIALIZERS = {
Expand Down Expand Up @@ -460,11 +459,6 @@ def add_ssh_keys():
LOCAL_LOAD_MAX_FILES_SIZE = 512 * 1024 * 1024 # 512 MB

RESTRICTIONS = {
'user_agreements': [],

# this setting reduces task visibility to owner and assignee only
'reduce_task_visibility': False,

# allow access to analytics component to users with business role
# otherwise, only the administrator has access
'analytics_visibility': True,
Expand Down
5 changes: 2 additions & 3 deletions site/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ weight = 1
section = ["HTML", "print"]

[params]
intel_terms_of_use = "https://www.intel.com/content/www/us/en/legal/terms-of-use.html"
intel_privacy_notice = "https://www.intel.com/content/www/us/en/privacy/intel-privacy-notice.html"
cvat_terms_of_use = "https://cvat.org/api/restrictions/terms-of-use"
cvat_ai_terms_of_use = "https://www.cvat.ai/terms-of-use"
cvat_privacy_notice = "https://www.cvat.ai/privacy"

# First one is picked as the Twitter card image if not set on page.
# images = ["images/project-illustration.png"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Requests are divided into groups:
- `jobs` -requests to manage the job
- `lambda` - requests to work with lambda function
- `projects` - project management queries
- `restrictions` - requests for restrictions
- `reviews` -adding and removing the review of the job
- `server` - server information requests
- `tasks` - requests to manage tasks
Expand Down
13 changes: 2 additions & 11 deletions site/i18n/en.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# Footer text
[footer_intel_privacy_notice]
[footer_cvat_ai_privacy_notice]
other = "Privacy Policy"

[footer_intel_terms_of_use]
[footer_cvat_ai_terms_of_use]
other = "Terms of Use"

[footer_cvat_terms_of_use]
other = "CVAT terms of Use"

[footer_notices_and_disclaimers]
other = "Notices and Disclaimers"

[footer_human_rights_principles]
other = "Human Rights Principles"
Loading

0 comments on commit 570bc38

Please sign in to comment.