Skip to content

Commit

Permalink
Improve password for mature
Browse files Browse the repository at this point in the history
  • Loading branch information
fgl27 committed Jul 28, 2024
1 parent 1ee956c commit 3d34368
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 43 deletions.
2 changes: 1 addition & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@

.stream_thumbnail_side {
width: 99.75%;
/*16 by 9 in relatetion to the width % size*/
/*16 by 9 in relation to the width % size*/
padding-bottom: 56.109375%;
background-repeat: no-repeat;
background: #000000;
Expand Down
2 changes: 2 additions & 0 deletions app/languages/0_Strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -763,3 +763,5 @@ var STR_ADD_USER_TEXT_COUNTER_NOW;
var STR_ADD_ERROR;
var STR_USER_TOKEN_ERROR;
var STR_REFRESH_PROBLEM_ENTER_LANG;
var STR_PASS_MATURE_ENABLED;
var STR_WRONG_PASS;
3 changes: 3 additions & 0 deletions app/languages/en_US.js
Original file line number Diff line number Diff line change
Expand Up @@ -874,4 +874,7 @@ function en_USLang() {
STR_ADD_USER_TEXT_COUNTER_NOW = 'Checking now!';
STR_ADD_ERROR = "Can't access the add user service";
STR_USER_TOKEN_ERROR = 'Lost access to current user, please revise the user section';

STR_WRONG_PASS = 'Wrong password!';
STR_PASS_MATURE_ENABLED = 'Mature content is enabled, old password deleted';
}
6 changes: 3 additions & 3 deletions app/specific/BrowserTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ function BrowserTestFun() {
pos = Settings_value_keys.indexOf(key);

if (pos > -1) {
Settings_RemoveinputFocus();
Settings_RemoveInputFocus();
Settings_cursorY = pos;
Settings_inputFocus(Settings_cursorY);
}
Expand Down Expand Up @@ -281,7 +281,7 @@ function BrowserTestFun() {

if (elemArray.length) {
var elem = elemArray[0].id.split('_')[0];
Settings_RemoveinputFocusKey(elem);
Settings_RemoveInputFocusKey(elem);
}

if (Main_A_includes_B(id, '.')) Settings_CodecsUpDownAfter(key);
Expand Down Expand Up @@ -334,7 +334,7 @@ function BrowserTestFun() {
pos = Settings_DialogValue.indexOf(key);

if (pos > -1) {
Settings_RemoveinputFocusKey(Settings_DialogValue[Settings_DialogPos]);
Settings_RemoveInputFocusKey(Settings_DialogValue[Settings_DialogPos]);
Settings_DialogPos = pos;
Settings_DialogUpDownAfter();
}
Expand Down
2 changes: 1 addition & 1 deletion app/specific/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2840,7 +2840,7 @@ function Main_CheckStop() {
//Hide setting if showing
if (Settings_isVisible()) {
if (Settings_Codecs_isVisible()) {
if (Settings_CodecsDialogSet) Settings_RemoveinputFocusKey(Settings_CodecsValue[Settings_CodecsPos].name);
if (Settings_CodecsDialogSet) Settings_RemoveInputFocusKey(Settings_CodecsValue[Settings_CodecsPos].name);
Main_HideElement('dialog_codecs');
Main_removeEventListener('keydown', Settings_handleKeyDownCodecs);
} else if (Settings_Dialog_isVisible()) {
Expand Down
63 changes: 35 additions & 28 deletions app/specific/Password.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,12 @@ function Password_init() {

function Password_exitWarning() {
Password_exit();
Main_showWarningDialog(STR_MATURE_NO_CHANGES);

Main_setTimeout(function () {
Main_HideWarningDialog();
}, 2000);
Password_showWarning(STR_MATURE_NO_CHANGES, 2000);
}

function Password_exit() {
Password_RemoveinputFocus(false);
Password_RemoveInputFocus(false);
Main_removeEventListener('keydown', Password_handleKeyDown);
Password_refreshInputFocusTools();
Main_values.Main_Go = Main_values.Main_BeforePassword;
Expand All @@ -64,7 +61,7 @@ function Password_exit() {
Main_PasswordInput.type = 'password';

Main_showSettings();
Settings_RemoveinputFocus();
Settings_RemoveInputFocus();
Settings_cursorY = Settings_cursorYBackup;
Settings_inputFocus(Settings_cursorY);
}
Expand All @@ -74,8 +71,11 @@ function Password_refreshInputFocusTools() {
Main_RemoveClass('password_save', 'button_search_focused');

if (Password_cursorY) {
if (!Password_cursorX) Main_AddClass('password_view', 'button_search_focused');
else if (Password_cursorX === 1) Main_AddClass('password_save', 'button_search_focused');
if (!Password_cursorX) {
Main_AddClass('password_view', 'button_search_focused');
} else if (Password_cursorX === 1) {
Main_AddClass('password_save', 'button_search_focused');
}
}
}

Expand Down Expand Up @@ -114,7 +114,7 @@ function Password_handleKeyDown(event) {
break;
case KEY_DOWN:
if (!Password_cursorY) {
Password_RemoveinputFocus(false);
Password_RemoveInputFocus(false);
Password_cursorY = 1;
Password_refreshInputFocusTools();
} else if (Password_cursorY === 1) {
Expand All @@ -135,24 +135,25 @@ function Password_handleKeyDown(event) {
}

function Password_KeyEnter() {
if (!Password_cursorY) Password_inputFocus();
else {
if (!Password_cursorY) {
Password_inputFocus();
} else {
if (!Password_cursorX) {
Main_PasswordInput.type = Main_PasswordInput.type === 'password' ? 'text' : 'password';
} else {
if (Main_PasswordInput.value !== '' && Main_PasswordInput.value !== null) {
var showRemoveWarn = false;
if (Settings_enable_matureBackup) {
//password enabled

if (Main_values.Password_data !== Main_PasswordInput.value) {
Main_showWarningDialog('worng pass');

Main_setTimeout(function () {
Main_HideWarningDialog();
}, 1000);
Password_showWarning(STR_WRONG_PASS, 1500);

return;
}

Main_values.Password_data = null;
showRemoveWarn = true;
} else {
//password disabled

Expand All @@ -166,17 +167,27 @@ function Password_KeyEnter() {

Settings_setMature(Settings_enable_matureBackup);
Password_exit();
} else {
Main_showWarningDialog(STR_SEARCH_EMPTY);
Main_SaveValues();

Main_setTimeout(function () {
Main_HideWarningDialog();
}, 1000);
if (showRemoveWarn) {
//Password_exit will hide the warning show after exit
Password_showWarning(STR_PASS_MATURE_ENABLED, 5000);
}
} else {
Password_showWarning(STR_SEARCH_EMPTY, 1000);
}
}
}
}

function Password_showWarning(warning, time) {
Main_showWarningDialog(warning);

Main_setTimeout(function () {
Main_HideWarningDialog();
}, time);
}

function Password_CheckIfStrong(password) {
var warning = '';
if (!password.match(/[0-9]+/)) {
Expand All @@ -192,11 +203,7 @@ function Password_CheckIfStrong(password) {
}

if (warning) {
Main_showWarningDialog(warning);

Main_setTimeout(function () {
Main_HideWarningDialog();
}, 2000);
Password_showWarning(warning, 2000);

return false;
}
Expand All @@ -223,7 +230,7 @@ function Password_inputFocus() {
);
}

function Password_RemoveinputFocus(EnaKeydown) {
function Password_RemoveInputFocus(EnaKeydown) {
Main_clearTimeout(Password_inputFocusId);
if (!Main_isTV && Main_IsOn_OSInterface) OSInterface_mhideSystemUI();

Expand Down Expand Up @@ -266,7 +273,7 @@ function Password_KeyboardEvent(event) {

function Password_KeyboardDismiss() {
Main_clearTimeout(Password_inputFocusId);
Password_RemoveinputFocus(true);
Password_RemoveInputFocus(true);
Password_cursorY = 1;
Password_refreshInputFocusTools();
}
20 changes: 10 additions & 10 deletions app/specific/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ function Settings_exit() {
Main_removeEventListener('keydown', Settings_handleKeyDown);
Main_IconLoad('label_thumb', 'icon-options', STR_THUMB_OPTIONS_TOP);
Main_ShowElement('label_refresh');
Settings_RemoveinputFocus();
Settings_RemoveInputFocus();
Main_HideElement('settings_holder');
}

Expand Down Expand Up @@ -1198,11 +1198,11 @@ function Settings_inputFocus(position) {
Settings_ScrollTable();
}

function Settings_RemoveinputFocus() {
Settings_RemoveinputFocusKey(Settings_value_keys[Settings_cursorY]);
function Settings_RemoveInputFocus() {
Settings_RemoveInputFocusKey(Settings_value_keys[Settings_cursorY]);
}

function Settings_RemoveinputFocusKey(key) {
function Settings_RemoveInputFocusKey(key) {
Main_getElementById(key + '_arrow_left').style.opacity = '0';
Main_getElementById(key + '_arrow_right').style.opacity = '0';
Main_RemoveClass(key, 'settings_value_focus');
Expand Down Expand Up @@ -1883,14 +1883,14 @@ function Settings_handleKeyDown(event) {
break;
case KEY_UP:
if (Settings_cursorY > 0) {
Settings_RemoveinputFocus();
Settings_RemoveInputFocus();
Settings_cursorY--;
Settings_inputFocus(Settings_cursorY);
}
break;
case KEY_DOWN:
if (Settings_cursorY < Settings_positions_length - 1) {
Settings_RemoveinputFocus();
Settings_RemoveInputFocus();
Settings_cursorY++;
Settings_inputFocus(Settings_cursorY);
}
Expand Down Expand Up @@ -1981,7 +1981,7 @@ function Settings_CodecsShow(click) {
}

function Settings_handleKeyDownReturn() {
Settings_RemoveinputFocusKey(Settings_CodecsValue[Settings_CodecsPos].name);
Settings_RemoveInputFocusKey(Settings_CodecsValue[Settings_CodecsPos].name);
Main_HideElement('dialog_codecs');
Main_removeEventListener('keydown', Settings_handleKeyDownCodecs);
Main_addEventListener('keydown', Settings_handleKeyDown);
Expand Down Expand Up @@ -2027,7 +2027,7 @@ function Settings_Codecs_isVisible() {
}

function Settings_CodecsUpDown(offset) {
Settings_RemoveinputFocusKey(Settings_CodecsValue[Settings_CodecsPos].name);
Settings_RemoveInputFocusKey(Settings_CodecsValue[Settings_CodecsPos].name);
Settings_CodecsPos += offset;
Settings_CodecsUpDownAfter(Settings_CodecsValue[Settings_CodecsPos].name);
}
Expand Down Expand Up @@ -2978,7 +2978,7 @@ function Settings_DialogShow(obj, title, click) {
}

function Settings_DialoghandleKeyReturn() {
Settings_RemoveinputFocusKey(Settings_DialogValue[Settings_DialogPos]);
Settings_RemoveInputFocusKey(Settings_DialogValue[Settings_DialogPos]);
Main_HideElement('dialog_settings');
Main_removeEventListener('keydown', Settings_DialoghandleKeyDown);
Main_addEventListener('keydown', Settings_handleKeyDown);
Expand Down Expand Up @@ -3024,7 +3024,7 @@ function Settings_DialoghandleKeyDown(event) {
}

function Settings_DialogUpDown(offset) {
Settings_RemoveinputFocusKey(Settings_DialogValue[Settings_DialogPos]);
Settings_RemoveInputFocusKey(Settings_DialogValue[Settings_DialogPos]);
Settings_DialogPos += offset;
Settings_DialogUpDownAfter();
}
Expand Down

0 comments on commit 3d34368

Please sign in to comment.