Skip to content

Commit

Permalink
Fix authentication code
Browse files Browse the repository at this point in the history
  • Loading branch information
CodaKhan committed Apr 7, 2017
1 parent 2289b1c commit 813d5a2
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 20 deletions.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,57 @@
1. Install with `npm install`.
2. Start with `grunt serve`.


## Objectives

By the time you submit this project, developers will have covered new ground in
many of the big themes of the course:

- **Command Line**: Interacting with the computer and navigating the
filesystem from the command line.
- **Source Control**: Managing and interacting with a git repository to store
changes to code.
- **Programming Fundamentals**: Working with objects, constructors, and
events, while learning how to strategically solve problems and resolve
errors.
- **Web Fundamentals**: Structuring, styling, and animating documents within
a browser; responding to actions your users take and the data they input
into the browser.
- **Browser Applications**: Using AJAX to connect to a back-end application.
- **Server Applications**: We haven't covered a ton of server-side
technologies yet (that's up next), but we learned a bit about how API
endpoints work, and how to get data from them.
- **Security**: With JavaScript closures, scratching the surface of why
security matters.
- **Deployment**: Host a static web site in a managed hosting environment
(GitHub Pages)
- **Products and Teams**: Document your code and your code repository so
others understand what you've built.

## Goals

At a high level, here are our goals for you in this project:

- **Build a web application from scratch**, without a starter codebase
- Use your programming skills to **map out the game logic for a simple game
like Tic Tac Toe**
- **Separate HTML, CSS, and JavaScript files** in your application
- Build an application **to a spec that someone else gives you**
- **Build a dynamic game that allows two players to compete** (bonus: compete
from separate devices)
- **Craft a ``readme.md`` file that explains your app** to the world
- **Communicate with a back-end** (which we'll provide for you) to store the
state of your game.

You will be working individually for this project, but we'll be guiding you
along the process and helping as you go. Everyone will get a chance to **be
creative**, and work through some really **tough programming challenges** to get
your feet wet in the world of web development. Those who dare will have the
tools to make it **multi-player, and multi-device** – so you can say to someone,
"hand me your phone," load up the game, and play a quick round!



## [License](LICENSE)

1. All content is licensed under a CC­BY­NC­SA 4.0 license.
Expand Down
3 changes: 2 additions & 1 deletion assets/scripts/auth/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const signIn = (data) => {
}

const changePassword = (data) => {
console.log('data is ', data)
console.log('changePassword Data is ', data)
console.log('changePassword Store is ', store.user)
return $.ajax({
url: config.apiOrigin + '/change-password/' + store.user.id,
method: 'PATCH',
Expand Down
5 changes: 1 addition & 4 deletions assets/scripts/auth/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const signUpFailure = (error) => {
}

const signInSuccess = (data) => {
console.log('You logged in Successfully. data: ', data)
console.log('You logged in Successfully. data: ', data.user)
store.user = data.user
console.log('Sign in successful')
console.log('You logged in Successfully. store: ', store)
Expand All @@ -23,10 +23,7 @@ const signInFailure = (error) => {
}

const changePasswordSuccess = (data) => {
console.log('You Successfully Changed your Password. data: ', data)
store.user = data.user
console.log('ChangePassword successful')
console.log('You Successfully Changed your Password. store: ', store)
}

const changePasswordFailure = (error) => {
Expand Down
25 changes: 14 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<!-- Do not add `script` tags unless you know what you are doing -->
<script src="public/vendor.js" type="text/javascript" charset="utf-8" defer></script>
<script src="public/application.js" type="text/javascript" charset="utf-8" defer></script>
<script src="assets/scripts/game/ticTacToe.js" type="text/javascript" charset="utf-8" defer></script>

</head>
<body>
Expand Down Expand Up @@ -52,9 +51,8 @@
</nav>

<div class="container-fluid">
<div class="row row-offcanvas row-offcanvas-left">

<div class="col-sm-3 col-md-2" role="navigation">
<div class="row row-offcanvas row-offcanvas-left">
<div class="col-sm-3 col-md-2" role="navigation">

<form class="sign-up">
<fieldset>
Expand All @@ -66,7 +64,17 @@
</fieldset>
</form>

</div><!--/span-->
<form id="change-password">
<fieldset>
<legend>Change Password!</legend>
<input type="password" name="passwords[old]" id="change-password-old" value="" placeholder="Old Password">
<input type="password" name="passwords[new]" id="change-password-new" value="" placeholder="New Password">
<input type="submit" name="submit" value="change-password">
</fieldset>
</form>


</div><!--/span-->

<div class="col-sm-9 col-md-10 main">
<!--toggle sidebar button-->
Expand Down Expand Up @@ -101,12 +109,7 @@ <h1 ID="message" class="page-header">This is where the message will go</h1>
</div>
</div><!--/.container-->


</div>
</div>



</body>
<script src="assets/scripts/game/ticTacToe.js"></script>

</html>
8 changes: 4 additions & 4 deletions scripts/change-password.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#curl "http://localhost:3000/change-password/${ID}" \
# ID=5 OLDPW=pwd NEWPW=passwd TOKEN=BAhJIiVkNjMwYmZjMDVlOGVhMGU4NmRiZDUxNzAwNDJkMDg4YQY6BkVG--bb47bf6c1e53284b932c0075a23e2249ba12f8d3 scripts/change-password.sh
ID="1"
OLDPW="pw"
NEWPW="passwd"
ID="3"
OLDPW="two"
NEWPW="two"

TOKEN="BAhJIiUxNTAyYjYxNGY3ZGIxMzQ4ZjRhNmMwZGY0ZjJiMjM1ZAY6BkVG--5313971010c31ef02b1fb68f49b2a4508d11b6da"
TOKEN="BAhJIiVhMWQyMjM0NjkxMWViN2I2NDhmMzcwY2RkNzUyOTA2MQY6BkVG--2403d578ef98af87fc257daa91e2a71d8445dfa7"
API="${API_ORIGIN:-http://localhost:4741}"
URL_PATH="/change-password/$ID"

Expand Down

0 comments on commit 813d5a2

Please sign in to comment.