Skip to content

Commit

Permalink
Merge pull request binary-com#1 from matin-binary/feature/trading-pas…
Browse files Browse the repository at this point in the history
…sword

Trading password & Unlinking social signup
  • Loading branch information
mamali-fs committed Apr 13, 2021
2 parents 44f1868 + 5e7db25 commit 1fa0b54
Show file tree
Hide file tree
Showing 19 changed files with 669 additions and 66 deletions.
1 change: 1 addition & 0 deletions scripts/config/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module.exports = [
['user/reality_check_frequency', 'app/user/reality_check/frequency', 'default', 'Reality Check'],
['user/reality_check_summary', 'app/user/reality_check/summary', 'default', 'Reality Check'],
['user/reset_passwordws', 'app/user/reset_password', 'default', 'Password Reset'],
['user/trading_reset_passwordws', 'app/user/trading_reset_password', 'default', 'Trading Password Reset'],
['user/securityws', 'app/user/security', 'default', 'Security'],
['user/security/closure', 'app/user/security/account_closure', 'default', 'Account Closure'],
['user/security/api_tokenws', 'app/user/security/api_token', 'default', 'API Token'],
Expand Down
1 change: 1 addition & 0 deletions src/images/pages/account_password/ic-linked-apple.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/images/pages/account_password/ic-linked-facebook.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/images/pages/account_password/ic-linked-google.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions src/javascript/_common/base/login.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const Cookies = require('js-cookie');
const Client = require('./client_base');
const getLanguage = require('../language').get;
const isMobile = require('../os_detect').isMobile;
const isStorageSupported = require('../storage').isStorageSupported;
Expand All @@ -11,7 +10,7 @@ const getAppId = require('../../config').getAppId;

const Login = (() => {
const redirectToLogin = () => {
if (!Client.isLoggedIn() && !isLoginPages() && isStorageSupported(sessionStorage)) {
if (!isLoginPages() && isStorageSupported(sessionStorage)) {
sessionStorage.setItem('redirect_url', window.location.href);
window.location.href = loginUrl();
}
Expand Down
4 changes: 3 additions & 1 deletion src/javascript/app/base/binary_pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const RealAccOpening = require('../pages/user/new_account/real_acc_open
const VirtualAccOpening = require('../pages/user/new_account/virtual_acc_opening');
const WelcomePage = require('../pages/user/new_account/welcome_page');
const ResetPassword = require('../pages/user/reset_password');
const TradingResetPassword = require('../pages/user/trading_reset_password');
const SetCurrency = require('../pages/user/set_currency');
const TelegramBot = require('../pages/user/telegram_bot');
const TNCApproval = require('../pages/user/tnc_approval');
Expand Down Expand Up @@ -119,7 +120,7 @@ const pages_config = {
realws : { module: RealAccOpening, is_authenticated: true },
redirect : { module: Redirect },
regulation : { module: Regulation },
reset_passwordws : { module: ResetPassword, not_authenticated: true },
reset_passwordws : { module: ResetPassword, is_authenticated: false },
resources : { module: Dashboard },
securityws : { module: Settings, is_authenticated: true },
self_exclusionws : { module: SelfExclusion, is_authenticated: true, only_real: true },
Expand All @@ -128,6 +129,7 @@ const pages_config = {
tnc_approvalws : { module: TNCApproval, is_authenticated: true, only_real: true },
top_up_virtualws : { module: TopUpVirtual, is_authenticated: true, only_virtual: true },
trading : { module: TradePage, needs_currency: true, no_mf: true },
trading_reset_passwordws : { module: TradingResetPassword, is_authenticated: false },
transferws : { module: PaymentAgentTransfer, is_authenticated: true, only_real: true },
two_factor_authentication: { module: TwoFactorAuthentication, is_authenticated: true },
virtualws : { module: VirtualAccOpening, not_authenticated: true },
Expand Down
2 changes: 1 addition & 1 deletion src/javascript/app/base/logged_in.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const LoggedInHandler = (() => {
// redirect back
let set_default = true;
if (redirect_url) {
const do_not_redirect = ['reset_passwordws', 'lost_passwordws', 'change_passwordws', 'home', '404'];
const do_not_redirect = ['trading_reset_passwordws', 'reset_passwordws', 'lost_passwordws', 'change_passwordws', 'home', '404'];
const reg = new RegExp(do_not_redirect.join('|'), 'i');
if (!reg.test(redirect_url) && urlFor('') !== redirect_url) {
set_default = false;
Expand Down
1 change: 1 addition & 0 deletions src/javascript/app/base/redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const Redirect = (() => {
const actions_map = {
signup : { path: 'new_account/virtualws' },
reset_password : { path: 'user/reset_passwordws' },
trading_platform_password_reset : { path: 'user/trading_reset_passwordws' },
payment_withdraw : { path: 'cashier/forwardws', query: 'action=withdraw' },
payment_agent_withdraw : { path: 'paymentagent/withdrawws' },
trading_platform_investor_password_reset: { path: 'user/metatrader' },
Expand Down
14 changes: 12 additions & 2 deletions src/javascript/app/common/form_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,23 @@ const BinarySocket = require('../base/socket');
const getHashValue = require('../../_common/url').getHashValue;
const isEmptyObject = require('../../_common/utility').isEmptyObject;
const showLoadingImage = require('../../_common/utility').showLoadingImage;
const getElementById = require('../../_common/common_functions').getElementById;

const FormManager = (() => {
const forms = {};

const initForm = (form_selector, fields, needs_token) => {
const initForm = (form_selector, fields, needs_token, should_set_trading_password) => {
const $form = $(`${form_selector}:visible`);
const $btn = $form.find('button[type="submit"]');
let $btn;
if (form_selector === '#frm_trading_password') {
if (should_set_trading_password) {
$btn = $form.find(getElementById('set_trading_btn'));
} else {
$btn = $form.find(getElementById('change_trading_pw_btn'));
}
} else {
$btn = $form.find('button[type="submit"]');
}
if ($form.length) {
forms[form_selector] = {
$btn_submit: $btn,
Expand Down
Loading

0 comments on commit 1fa0b54

Please sign in to comment.