Skip to content

Commit acca3a9

Browse files
authored
fix(sign-up): clean phone by adding prefix if not present (#1317)
* fix(sign-up): clean phone by adding prefix if not present * fix(sign-up): set sessionStorage value for tracking * fix(sign-up): phone number clean and validation * fix(sign-up): change logo again * build(sign-up): remove img assets * fix(sign-up): phone number clean * fix(sign-up): add some router param to allow auto state refresh
1 parent 6ec8a3e commit acca3a9

File tree

8 files changed

+28
-24
lines changed

8 files changed

+28
-24
lines changed

packages/manager/apps/sign-up/src/assets/img/logo-ovh.svg

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/manager/apps/sign-up/src/constants.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ export const HOME_PAGE = {
2323
WS: 'https://www.ovh.com/us/es/',
2424
};
2525

26+
export const OVH_LOGO = 'https://eu.api.ovh.com/images/com-square-bichro.png';
27+
2628
export const SANITIZATION = {
2729
regex: /^\s*(?:(?:(?:https?|ftp|file|blob):\/\/(?:(?:(?:[^./?#]+\.)*(?:ovh|(?:ovhcloud(?=\.com))|(?:ovhtelecom(?=\.fr))|(?:ovh-hosting(?=\.fi))|soyoustart|kimsufi|runabove)\.(?: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|[\w-]+\.uxci(-ca|-us)?\.ovh)(?::\d+)?)|data:image)(?:\/|$)/i,
2830
};
2931

3032
export default {
3133
HOME_PAGE,
34+
OVH_LOGO,
3235
SANITIZATION,
3336
};

packages/manager/apps/sign-up/src/index.controller.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import get from 'lodash/get';
22

3-
import { HOME_PAGE } from './constants';
3+
import {
4+
HOME_PAGE,
5+
OVH_LOGO,
6+
} from './constants';
47

58
export default class SignUpCtrl {
69
/* @ngInject */
@@ -10,6 +13,7 @@ export default class SignUpCtrl {
1013

1114
// other attributes used in view
1215
this.logoUrl = null;
16+
this.logoSrc = OVH_LOGO;
1317
}
1418

1519
/* ============================

packages/manager/apps/sign-up/src/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
<div class="py-3 py-md-5 px-3">
1414
<a class="d-inline-block pb-3 pb-md-5"
1515
data-ng-href="{{ $ctrl.logoUrl }}">
16-
<img src="assets/img/logo-ovh.svg"
17-
alt="OVHcloud - Innovation for freedom" />
16+
<img data-ng-src="{{ $ctrl.logoSrc }}"
17+
alt="OVHcloud - Innovation for freedom"
18+
class="app-logo" />
1819
</a>
1920
<div class="row justify-content-lg-center">
2021
<div class="col-lg-8 app-content">

packages/manager/apps/sign-up/src/index.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
@import '~bootstrap4/scss/_grid.scss';
66
@import '~bootstrap4/scss/mixins/_breakpoints';
77

8+
.app-logo {
9+
height: 70px;
10+
}
11+
812
.app-content {
913
position: relative;
1014
}

packages/manager/apps/sign-up/src/routing.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import signupFormComponent from './form/component';
66

77
export const state = {
88
name: 'sign-up',
9-
url: '/?lang',
9+
url: '/?lang&ovhSubsidiary&ovhCompany&callback&onsuccess',
1010
component: signupFormComponent.name,
1111
resolve: {
1212
getRedirectLocation: /* @ngInject */ $location => (nic) => {
@@ -55,6 +55,11 @@ export const state = {
5555
finishSignUp: /* @ngInject */ ($window, getRedirectLocation, me, signUp) => () => signUp
5656
.saveNic(me.model)
5757
.then(() => {
58+
// for tracking purposes
59+
if ($window.sessionStorage) {
60+
$window.sessionStorage.setItem('ovhSessionSuccess', true);
61+
}
62+
// manage redirection
5863
const redirectUrl = getRedirectLocation(me.nichandle);
5964
if (redirectUrl) {
6065
$window.location.assign(redirectUrl);

packages/manager/apps/sign-up/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = (env = {}) => {
1212
assets: {
1313
files: [
1414
{ from: path.resolve(__dirname, '../../../../node_modules/flag-icon-css/flags/4x3'), to: 'flag-icon-css/flags/4x3' },
15-
{ from: path.resolve(__dirname, 'src/assets/img'), to: 'assets/img' },
15+
// { from: path.resolve(__dirname, 'src/assets/img'), to: 'assets/img' },
1616
],
1717
},
1818
}, process.env.REGION ? Object.assign(env, { region: process.env.REGION }) : env);

packages/manager/modules/sign-up/src/form/details/details.controller.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,20 @@ export default class SignUpDetailsCtrl {
4040

4141
static cleanPhoneNumber(phoneNumberParam, phonePrefix) {
4242
let phoneNumber = phoneNumberParam;
43-
if (phoneNumberParam) {
43+
if (phoneNumber) {
4444
phoneNumber = phoneNumber.replace(/\s/g, '');
4545
phoneNumber = phoneNumber.replace(/(?:-)(\d)/g, '$1'); // remove "-" char preceding a digit
4646
phoneNumber = phoneNumber.replace(/(?:\.)(\d)/g, '$1'); // remove "." char preceding a digit
4747
phoneNumber = phoneNumber.replace(/(?:\()(\d+)(?:\))/g, '$1'); // remove parenthesis around digits
4848

4949
if (phonePrefix) {
5050
const alternativePhonePrefix = `00${phonePrefix.replace('+', '')}`;
51-
if (startsWith(phoneNumberParam, alternativePhonePrefix)) {
51+
if (startsWith(phoneNumber, alternativePhonePrefix)) {
5252
// check if input value begin with 00${prefix}
53-
phoneNumber = `+${phonePrefix}${phoneNumberParam.slice(alternativePhonePrefix.length)}`;
54-
} else if (startsWith(phoneNumberParam, '0')) {
55-
// or by only a trailing 0
56-
phoneNumber = `+${phonePrefix}${phoneNumberParam.slice(1)}`;
53+
phoneNumber = `+${phonePrefix}${phoneNumber.slice(alternativePhonePrefix.length)}`;
54+
} else if (!startsWith(phoneNumber, `+${phonePrefix}`)) {
55+
// or not by the phonePrefix
56+
phoneNumber = `+${phonePrefix}${phoneNumber}`;
5757
}
5858
}
5959
}

0 commit comments

Comments
 (0)