Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[accounts] Password recovery - issue 480 #493

Merged
merged 6 commits into from
Aug 31, 2018

Conversation

hunght
Copy link
Contributor

@hunght hunght commented Aug 31, 2018

Changes

  • implemented reset password and reset pass code
  • wrote the test for new functions

Verification

  • Go to account then press Forgot password button
  • Enter mnemonic to verify.
  • Enter new password
  • Navigate user to login screen after reset pass success

Copy link
Contributor

@seland seland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works fine for me on iOS.
General note - naming validMnemonicWithAccount is not a verb and therefore should not be used for an action or function. Please change it to validateMnemonicWithAccount or like that.

@@ -95,6 +97,21 @@ export function login(accountId: string, password: string, deferred: boolean = f
};
}

/**
* @desc Action creator for an action that is called to perform a login.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs are inconsistent with the method name, please fix one of them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

* @param {string} accountId Id of account to login to.
* @param {function} callback Callback that is called with true if check is successful and false otherwise.
* @param {boolean} deferred Flag if login should wait for performDeferredLogin action to proceed.
* @return {LoginAction} An action.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returned type is inconsistent with one on method declaration, please fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -539,7 +539,8 @@
"password": {
"enterInstruction": "Enter password:",
"createInstruction": "Enter new password:",
"verifyInstruction": "Enter password again:"
"verifyInstruction": "Enter password again:",
"forgetInstruction": "Forget Password?"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it should be "Forgot password?" in past tense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -22,6 +22,10 @@ const styles = MediaQueryStyleSheet.create({
marginRight: 30,
textAlign: 'center',
},
forgetButton: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move it to global styles as it repeats itself several times.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -22,6 +22,10 @@ const styles = MediaQueryStyleSheet.create({
marginRight: 30,
textAlign: 'center',
},
forgetButton: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move it to global styles as it repeats itself several times.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -179,7 +187,17 @@ class EnterKeyScreen extends NavigatorComponent<Actions & KeyState & Props, Stat
}

onDonePressed = () => {
this.props.validateMnemonic();
if (_.has(this.props, 'processLogin')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

processLogin is not declared on Props type, please declare it there. Also, please use check like this.props.processLogin === true instead of using has.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

} = this.props;
const shouldShowForget = !isLoggedIn && has(this.props, 'accountId');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use this.props.accountId != null or similar instead of has.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

src/screens/Accounts/index.js Show resolved Hide resolved
}
const config = JSON.stringify({
encrypted_key_manager: accountStore,
// signed_profile: signedProfile,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the comment if it's not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -21,6 +22,7 @@ import {
CHECK_PASSWORD,
CHECK_PIN_CODE,
LOGIN,
VALID_MNEMONIC_WITH_ACCOUNT,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's better to update this naming to VALIDATE as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

onPress: async () => {
if (Platform.OS === 'ios') {
await navigator.dismissModal();
navigator.pop();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

navigator.pop() line is the same for both platforms, so can be moved outside of the if statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

static onForgetPasswordAccount = async (navigator: Navigator, currentAccountId: string) => {
if (Platform.OS === 'ios') {
await navigator.dismissModal();
navigator.push({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

navigator.push(...) line is the same for both platforms, so can be moved outside of the if statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

} = this.props;
const shouldShowForget = !isLoggedIn && this.props.accountId != null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use isLoggedIn === false instead of !isLoggedIn to prevent coercion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -179,7 +199,17 @@ class EnterKeyScreen extends NavigatorComponent<Actions & KeyState & Props, Stat
}

onDonePressed = () => {
this.props.validateMnemonic();
if (this.props.isOnResetPassProcess) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use this.props.isOnResetPassProcess === true to prevent coercion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

@seland seland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work

@seland seland added this to the 1.2.0 milestone Aug 31, 2018
Copy link
Contributor

@albertoestarrona albertoestarrona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

@seland seland merged commit af54da6 into develop Aug 31, 2018
@seland seland mentioned this pull request Aug 31, 2018
7 tasks
marknuzz pushed a commit that referenced this pull request Nov 14, 2018
…overy

[accounts] Password recovery - issue 480

Former-commit-id: af54da6
marknuzz pushed a commit that referenced this pull request Nov 14, 2018
…overy

[accounts] Password recovery - issue 480

Former-commit-id: 5de64c6 [formerly af54da6]
Former-commit-id: 417a568
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants