From 276f0cdbda712972b41e2a9f405ba2ce6168d63e Mon Sep 17 00:00:00 2001
From: nanowrit <59661202+nanowrit@users.noreply.github.com>
Date: Fri, 14 Feb 2020 11:50:07 -0700
Subject: [PATCH] Update allow-users-to-change-passwords.md
Proposing these changes to make this chapter more congruent with the core chapters of the guide.
Also, I have a replacement screenshot for the settings page with both the billing form and the change email/password buttons. Just let me know how to get it to you.
---
_chapters/allow-users-to-change-passwords.md | 103 +++++++++++++------
1 file changed, 70 insertions(+), 33 deletions(-)
diff --git a/_chapters/allow-users-to-change-passwords.md b/_chapters/allow-users-to-change-passwords.md
index 3881e9b11..5ff246527 100644
--- a/_chapters/allow-users-to-change-passwords.md
+++ b/_chapters/allow-users-to-change-passwords.md
@@ -14,52 +14,87 @@ For reference, we are using a forked version of the notes app with:
- A separate GitHub repository: [**{{ site.frontend_user_mgmt_github_repo }}**]({{ site.frontend_user_mgmt_github_repo }})
- And it can be accessed through: [**https://demo-user-mgmt.serverless-stack.com**](https://demo-user-mgmt.serverless-stack.com)
-Let's start by creating a settings page that our users can use to change their password.
+Let's start by adding a feature to the settings page that our users can use to change their password.
-### Add a Settings Page
+### The Settings Page
-Add the following to `src/containers/Settings.js`.
+
Replace the contents of `src/containers/Settings.js` with the following:
``` coffee
-import React, { Component } from "react";
+import React, { useState } from "react";
+import { API } from "aws-amplify";
+import { Elements, StripeProvider } from "react-stripe-elements";
import { LinkContainer } from "react-router-bootstrap";
import LoaderButton from "../components/LoaderButton";
+import BillingForm from "../components/BillingForm";
+import config from "../config";
import "./Settings.css";
-export default class Settings extends Component {
- constructor(props) {
- super(props);
+export default function Settings(props) {
+ const [isLoading, setIsLoading] = useState(false);
- this.state = {
- };
+ function billUser(details) {
+ return API.post("notes", "/billing", {
+ body: details
+ });
}
- render() {
- return (
-