Repository: wolfeidau/cognito-vue-bootstrap
Branch: master
Commit: 84801f7fa563
Files: 33
Total size: 34.2 KB
Directory structure:
gitextract_a2ppqcxr/
├── .browserslistrc
├── .eslintrc.js
├── .github/
│ └── workflows/
│ └── nodejs.yml
├── .gitignore
├── .nvmrc
├── LICENSE.md
├── Makefile
├── README.md
├── babel.config.js
├── jest.config.js
├── package.json
├── postcss.config.js
├── public/
│ └── index.html
├── src/
│ ├── App.vue
│ ├── aws-exports.js
│ ├── components/
│ │ ├── Footer.vue
│ │ ├── Menu.vue
│ │ └── auth/
│ │ └── Alert.vue
│ ├── main.js
│ ├── pages/
│ │ ├── Dashboard.vue
│ │ ├── Home.vue
│ │ └── auth/
│ │ ├── ChangePassword.vue
│ │ ├── ConfirmPasswordReset.vue
│ │ ├── ConfirmSignUp.vue
│ │ ├── PasswordReset.vue
│ │ ├── SignIn.vue
│ │ ├── SignOut.vue
│ │ └── SignUp.vue
│ ├── router/
│ │ └── index.js
│ └── store/
│ ├── index.js
│ └── modules/
│ └── auth.js
├── tests/
│ └── unit/
│ └── footer.spec.js
└── vue.config.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .browserslistrc
================================================
> 1%
last 2 versions
================================================
FILE: .eslintrc.js
================================================
module.exports = {
root: true,
env: {
node: true
},
extends: ["plugin:vue/essential", "@vue/prettier"],
rules: {
"no-console": process.env.NODE_ENV === "production" ? "error" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off"
},
parserOptions: {
parser: "babel-eslint"
},
overrides: [
{
files: [
"**/__tests__/*.{j,t}s?(x)",
"**/tests/unit/**/*.spec.{j,t}s?(x)"
],
env: {
jest: true
}
}
]
};
================================================
FILE: .github/workflows/nodejs.yml
================================================
name: Node CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
run: |
yarn
yarn run build --if-present
yarn jest
env:
CI: true
================================================
FILE: .gitignore
================================================
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
# Don't commit your aws mobile configuration file
.envrc
================================================
FILE: .nvmrc
================================================
10
================================================
FILE: LICENSE.md
================================================
Copyright 2018 Mark Wolfe
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: Makefile
================================================
ci: clean build deploy
clean:
rm -rf dist
build:
yarn build
deploy:
aws s3 sync dist/ s3://$(S3_HOSTING_BUCKET)/ --delete --acl public-read
aws cloudfront create-invalidation --distribution-id $(DISTRIBUTION_ID) --paths '/*'
================================================
FILE: README.md
================================================
# cognito-vue-bootstrap
This application illustrates how to use the [Amazon Amplify](https://github.com/aws/aws-amplify) with [vue.js](https://vuejs.org/), it includes signup, signin, signout, recover password and account verification using email or sms codes. It uses [bootstrap-vue](https://bootstrap-vue.js.org/) for layout.
# overview
This example application currently illustrates the following:
* Sign Up for an account
* Verify your account by entering verification code which has been sent to you via emailed or SMS
* Dashboard which requires authentication to access
* Change Password
* Recover Password using verification code which has been sent to you via emailed or SMS
* Sign In to the application
* Sign Out of the application
Demo version is located at https://cognito-vue-bootstrapv2.wolfe.id.au/
# Build Setup
Before you start have a read over [What is Amazon Cognito?](http://docs.aws.amazon.com/cognito/latest/developerguide/what-is-amazon-cognito.html)
To setup this project you first need to configure an aws mobile project using the following snapshot [CognitoVue](https://console.aws.amazon.com/mobilehub/home#/snapshot/ef9bu3t7nsa8uz).
For more information on this process see [Exporting and Importing AWS Mobile Hub Projects](https://docs.aws.amazon.com/aws-mobile/latest/developerguide/project-import-export.html)
Once you have imported the project you will have created:
* An S3 bucket with Cloudfront for your web application.
* A Cognito pool to store your users
* An analytics project to capture metrics on your users login / failure ect.
Click on the integrate button in your aws mobile project, the download and extract the cloud config zip file, find `aws-exports.js` inside, and replace this file in `src/` directory.
I use [yarn](https://yarnpkg.com/) to build and run this project.
``` bash
# install dependencies
yarn install
# serve with hot reload at localhost:8080
yarn serve
# build for production with minification
yarn build
```
Sync all the files from your `dist` directory up to the S3 hosting bucket within your AWS Mobile project using the following command.
```
aws --region ap-southeast-2 s3 sync dist/ s3://cognitovuebootstrap-hosting-mobilehub-XXXXXXXXXX/ --delete --acl public-read
```
# hosting configuration notes
To host a website on a custom URL using AWS mobile I have found some changes to the current setup. Navigating to the buckets and CDN configuration is done via the `Hosting And Streaming` panel in the mobile project UI.
* disable website hosting on the hosting S3 bucket
* add an Error Page which sends any 404 (not found) errors to `/index.html` in cloudfront
* enable redirect http -> https on the origin
* configure a route53 domain for your website
* configure a AWS Certificate Manager (ACM) certificate for your domain
* add an A record in route53 of type `alias` pointing to your Cloudfront distribution, then update the origin domain name to match the FQDN.
For a more detailed explanation on how things work, checkout:
* [AWS Amplify Documentation](https://aws.github.io/aws-amplify/)
* [AWS Amplify Modularization](https://github.com/aws-amplify/amplify-js/wiki/Amplify-modularization)
* [docs for vue-cli](https://cli.vuejs.org/)
* [docs for vue-router](http://router.vuejs.org/en/)
* [docs for vuex](https://vuex.vuejs.org/)
# License
This project is released under the Apache License, Version 2.0.
================================================
FILE: babel.config.js
================================================
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"]
};
================================================
FILE: jest.config.js
================================================
module.exports = {
preset: "@vue/cli-plugin-unit-jest"
};
================================================
FILE: package.json
================================================
{
"name": "cognito-vue-bootstrap",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@aws-amplify/auth": "^1.5.0",
"bootstrap-vue": "^2.0.4",
"core-js": "^3.3.2",
"vue": "^2.6.10",
"vue-awesome": "^3.5.4",
"vue-resource": "^1.5.1",
"vue-router": "^3.1.3",
"vuex": "^3.0.1",
"vuex-localstorage": "^1.0.0"
},
"devDependencies": {
"@testing-library/vue": "^4.1.0",
"@vue/cli-plugin-babel": "^4.0.0",
"@vue/cli-plugin-eslint": "^4.0.0",
"@vue/cli-plugin-router": "^4.0.0",
"@vue/cli-plugin-unit-jest": "^4.0.0",
"@vue/cli-plugin-vuex": "^4.0.0",
"@vue/cli-service": "^4.0.0",
"@vue/eslint-config-prettier": "^5.0.0",
"@vue/test-utils": "1.0.0-beta.29",
"babel-eslint": "^10.0.3",
"eslint": "^5.16.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^5.0.0",
"prettier": "^1.18.2",
"vue-template-compiler": "^2.6.10"
}
}
================================================
FILE: postcss.config.js
================================================
module.exports = {
plugins: {
autoprefixer: {}
}
};
================================================
FILE: public/index.html
================================================