From bab758c12b565120d9e6a5ff8a395ae1f3d69dbb Mon Sep 17 00:00:00 2001 From: Guillaume Vincent Date: Thu, 25 Nov 2021 21:52:36 +0100 Subject: [PATCH] Add an option to NOT copy the password when generating Fixes https://github.com/lesspass/lesspass/issues/673 --- mobile/ios/LessPass.xcodeproj/project.pbxproj | 4 ++-- mobile/package.json | 2 +- mobile/src/password/PasswordGeneratorScreen.js | 31 ++++++++++++++++++++------ mobile/src/settings/SettingsScreen.js | 14 +++++++++++- mobile/src/settings/settingsReducer.js | 1 + mobile/src/settings/settingsReducer.test.js | 1 + mobile/src/version.json | 2 +- 7 files changed, 43 insertions(+), 12 deletions(-) diff --git a/mobile/ios/LessPass.xcodeproj/project.pbxproj b/mobile/ios/LessPass.xcodeproj/project.pbxproj index 3d30b23..aa275b5 100644 --- a/mobile/ios/LessPass.xcodeproj/project.pbxproj +++ b/mobile/ios/LessPass.xcodeproj/project.pbxproj @@ -355,7 +355,7 @@ ); INFOPLIST_FILE = LessPass/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 9.5.3; + MARKETING_VERSION = 9.6.0; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -384,7 +384,7 @@ DEVELOPMENT_TEAM = 5Y4MF2AT83; INFOPLIST_FILE = LessPass/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 9.5.3; + MARKETING_VERSION = 9.6.0; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", diff --git a/mobile/package.json b/mobile/package.json index 7686b9c..2e1fa3f 100644 --- a/mobile/package.json +++ b/mobile/package.json @@ -1,6 +1,6 @@ { "name": "lesspass-mobile", - "version": "9.5.3", + "version": "9.6.0", "description": "LessPass mobile application", "license": "(MPL-2.0 OR GPL-3.0)", "author": "Guillaume Vincent ", diff --git a/mobile/src/password/PasswordGeneratorScreen.js b/mobile/src/password/PasswordGeneratorScreen.js index 61e36a9..c3f730f 100644 --- a/mobile/src/password/PasswordGeneratorScreen.js +++ b/mobile/src/password/PasswordGeneratorScreen.js @@ -38,6 +38,7 @@ function _getInitialState(settings) { symbols: settings.defaultSymbols, length: settings.defaultGeneratedPasswordLength, counter: settings.defaultCounter, + copyPasswordAfterGeneration: settings.copyPasswordAfterGeneration, password: null, }; } @@ -161,8 +162,10 @@ export default function PasswordGeneratorScreen() { state.masterPassword, passwordProfile ); - Clipboard.setString(password); - setCopied(true); + if (state.copyPasswordAfterGeneration) { + Clipboard.setString(password); + setCopied(true); + } setState((state) => ({ ...state, password })); } else { dispatch( @@ -173,13 +176,13 @@ export default function PasswordGeneratorScreen() { } }} > - GENERATE & COPY + {state.copyPasswordAfterGeneration ? "GENERATE & COPY" : "GENERATE"} + {state.password && state.copyPasswordAfterGeneration === false && ( + + )} {state.password && ( @@ -223,7 +240,7 @@ export default function PasswordGeneratorScreen() { ); }} icon="content-save" - style={{ marginLeft: 5 }} + style={{ marginRight: 10, marginBottom: 10 }} > Save @@ -240,7 +257,7 @@ export default function PasswordGeneratorScreen() { ); }} icon="content-save" - style={{ marginLeft: 5 }} + style={{ marginRight: 10, marginBottom: 10 }} > Update diff --git a/mobile/src/settings/SettingsScreen.js b/mobile/src/settings/SettingsScreen.js index 2552a43..71ae5e3 100644 --- a/mobile/src/settings/SettingsScreen.js +++ b/mobile/src/settings/SettingsScreen.js @@ -42,6 +42,7 @@ export class SettingsScreen extends Component { defaultDigits, defaultSymbols, defaultCounter, + copyPasswordAfterGeneration, } = settings; return ( @@ -162,9 +163,20 @@ export class SettingsScreen extends Component { )} + + setSettings({ copyPasswordAfterGeneration: value }) + } + /> + + - ); } diff --git a/mobile/src/settings/settingsReducer.js b/mobile/src/settings/settingsReducer.js index ddc6503..2d9706d 100644 --- a/mobile/src/settings/settingsReducer.js +++ b/mobile/src/settings/settingsReducer.js @@ -11,6 +11,7 @@ const initialState = { defaultDigits: defaultPasswordProfile.digits, defaultSymbols: defaultPasswordProfile.symbols, defaultCounter: defaultPasswordProfile.counter, + copyPasswordAfterGeneration: true, }; export default function (state = initialState, action) { diff --git a/mobile/src/settings/settingsReducer.test.js b/mobile/src/settings/settingsReducer.test.js index 10f9a24..cc4d3d8 100644 --- a/mobile/src/settings/settingsReducer.test.js +++ b/mobile/src/settings/settingsReducer.test.js @@ -13,6 +13,7 @@ describe("settings reducer", () => { defaultDigits: true, defaultSymbols: true, defaultCounter: 1, + copyPasswordAfterGeneration: true, }); }); it("SET_SETTINGS", () => { diff --git a/mobile/src/version.json b/mobile/src/version.json index c04fd24..59c17fa 100644 --- a/mobile/src/version.json +++ b/mobile/src/version.json @@ -1,3 +1,3 @@ { - "version": "9.5.3" + "version": "9.6.0" }