This repository was archived by the owner on Feb 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 228
Expand file tree
/
Copy pathtrading_reset_password.js
More file actions
52 lines (46 loc) · 2.22 KB
/
trading_reset_password.js
File metadata and controls
52 lines (46 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const BinaryPjax = require('../../base/binary_pjax');
const Dialog = require('../../common/attach_dom/dialog');
const FormManager = require('../../common/form_manager');
const localize = require('../../../_common/localize').localize;
const getElementById = require('../../../_common/common_functions').getElementById;
const Url = require('../../../_common/url');
const isEuCountry = require('../../common/country_base').isEuCountry;
const TradingResetPassword = (() => {
const responseHandler = (response) => {
if (response.error) {
getElementById('container_trading_reset_password').setVisibility(0);
const $form_error = $('#form_error');
getElementById('msg_reset_password').setVisibility(0);
const err_msg = response.error.message;
$form_error.find('#form_error_retry').setVisibility(0);
getElementById('form_error_msg').innerHTML = err_msg;
getElementById('form_error_cta').setVisibility(1);
$form_error.setVisibility(1);
} else {
Dialog.alert({
id : 'success_reset_trading_pw_dialog',
localized_message: localize('You have a new MT5 password to log in to your [_1] accounts on the desktop, web and mobile apps.', isEuCountry() ? 'CFDs' : 'MT5'),
localized_title : localize('Success'),
ok_text : localize('Done'),
onConfirm : () => { BinaryPjax.load(Url.urlFor('user/metatrader')); },
});
}
};
const onLoad = () => {
const form_id = '#frm_trading_reset_password';
FormManager.init(form_id, [
{ selector: '#have_real_account', validations: ['req'], exclude_request: 1 },
{ selector: '#new_password', validations: ['req', 'password'] },
{ request_field: 'trading_platform_password_reset', value: 1 },
{ request_field: 'platform', value: 'mt5' },
], true);
FormManager.handleSubmit({
form_selector : form_id,
fnc_response_handler: responseHandler,
});
};
return {
onLoad,
};
})();
module.exports = TradingResetPassword;