Skip to content

Commit

Permalink
feat(sign-up): restrict request for us
Browse files Browse the repository at this point in the history
ref: MANAGER-11426

Signed-off-by: Jacques Larique <[email protected]>
  • Loading branch information
Jacques Larique committed Aug 3, 2023
1 parent eb0f63d commit 31b6008
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/manager/apps/sign-up/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@ovh-ux/ng-at-internet-ui-router-plugin": "^3.2.3",
"@ovh-ux/ng-ovh-http": "^5.0.6",
"@ovh-ux/ng-ovh-request-tagger": "^1.1.8",
"@ovh-ux/ng-ovh-feature-flipping": "^1.0.7",
"@ovh-ux/ng-ovh-sso-auth": "^4.7.0",
"@ovh-ux/ng-translate-async-loader": "^2.1.6",
"@ovh-ux/request-tagger": "^0.1.1",
Expand Down
2 changes: 2 additions & 0 deletions packages/manager/apps/sign-up/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import '@uirouter/angularjs';
import 'regenerator-runtime/runtime';
import { registerCoreModule } from '@ovh-ux/manager-core';

import ngOvhFeatureFlipping from '@ovh-ux/ng-ovh-feature-flipping';
import ngOvhSsoAuth from '@ovh-ux/ng-ovh-sso-auth'; // peerDep of manager-core
import ngAtInternet from '@ovh-ux/ng-at-internet';
import ovhManagerCookiePolicy from '@ovh-ux/manager-cookie-policy';
Expand Down Expand Up @@ -48,6 +49,7 @@ export default (containerEl, environment) => {
ovhManagerAtInternetConfiguration,
ovhManagerCookiePolicy,
ngAtInternetUiRouterPlugin,
ngOvhFeatureFlipping,
ngOvhSsoAuth,
signUpFormView,
detailsState,
Expand Down
5 changes: 5 additions & 0 deletions packages/manager/apps/sign-up/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@ export const SANITIZATION = {
regex: /^\s*(?:(?:(?:https?|ftp|file|blob):\/\/(?:(?:(?:[^./?#]+\.)*(?:ovh|(?:ovhcloud(?=\.com))|(?:ovhtelecom(?=\.fr))|(?:ovh-hosting(?=\.fi))|soyoustart|kimsufi)\.(?:com|net|org|ovh|co\.uk|com\.tn|cz|de|es|eu|fi|fr|ie|it|lt|ma|nl|pl|pt|sn|uk|us))|localhost|127\.0\.0\.1)(?::\d+)?)|data:image)(?:\/|$)/i,
};

export const FEATURES = {
smsConsent: 'account:sms-consent',
};

export default {
HOME_PAGE,
LOGO_SRC,
SANITIZATION,
FEATURES,
};
22 changes: 17 additions & 5 deletions packages/manager/apps/sign-up/src/routing.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import find from 'lodash/find';

import { SANITIZATION } from './constants';
import { SANITIZATION, FEATURES } from './constants';

import signupFormComponent from './form/component';

Expand Down Expand Up @@ -70,14 +70,26 @@ export const state = {
}
},

isSmsConsentAvailable: /* @ngInject */ (ovhFeatureFlipping) =>
ovhFeatureFlipping
.checkFeatureAvailability(FEATURES.smsConsent)
.then((featureAvailability) =>
featureAvailability.isFeatureAvailable(FEATURES.smsConsent),
),

finishSignUp: /* @ngInject */ (
$window,
$q,
getRedirectLocation,
me,
signUp,
isSmsConsentAvailable,
) => (smsConsent) =>
signUp.saveNic(me.model).then(() =>
signUp.sendSmsConsent(smsConsent).then(() => {
signUp.saveNic(me.model).then(() => {
const promise = isSmsConsentAvailable
? signUp.sendSmsConsent(smsConsent)
: $q.resolve();
return promise.then(() => {
// for tracking purposes
if ($window.sessionStorage) {
$window.sessionStorage.setItem('ovhSessionSuccess', true);
Expand All @@ -87,8 +99,8 @@ export const state = {
if (redirectUrl) {
$window.location.assign(redirectUrl);
}
}),
),
});
}),

steps: () => [
{
Expand Down

0 comments on commit 31b6008

Please sign in to comment.