Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feat | finalize code
- Loading branch information
1 parent
ed0d9c3
commit e8c1317
Showing
14 changed files
with
417 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // {type:activity} | ||
| // {generate:true} | ||
| (start)-><a>[GET /]-><b>[logged in]->(Show homepage)->(end) | ||
| <b>[else]->(Show login)->(end) | ||
|
|
||
| <a>[GET /users]-><c>[logged in]->(Show users)->(end) | ||
| <c>[else]->(Show login) | ||
|
|
||
| <a>[GET /about]-><d>[logged in]->(Show about with bar)->(end) | ||
| <d>[else]->(Show about without bar)->(end) | ||
|
|
||
| <a>[POST /login]->(Check login) | ||
| (Check login)-><e>[success]->(Login and redirect /)->(Show homepage) | ||
| <e>[else]->(Show Login with error)->(end) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| var express = require("express"); | ||
| var router = express.Router(); | ||
|
|
||
| /* GET about page. */ | ||
| router.get("/", function(req, res, next) { | ||
| res.render("about", { title: "About", loggedIn: req.session.loggedIn }); | ||
| }); | ||
|
|
||
| module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,12 @@ | ||
| var express = require('express'); | ||
| var express = require("express"); | ||
| var router = express.Router(); | ||
|
|
||
| /* GET users listing. */ | ||
| router.get('/', function(req, res, next) { | ||
| res.send('respond with a resource'); | ||
| router.get("/", function(req, res, next) { | ||
| res.render("users", { | ||
| title: "User listing", | ||
| users: [{ username: "admin", password: "admin" }] | ||
| }); | ||
| }); | ||
|
|
||
| module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| extends layout | ||
|
|
||
| block content | ||
| if loggedIn | ||
| include header | ||
| div(class="wrapper") | ||
| div(class="form-signin") | ||
| h1 About this page | ||
| p See code at #[a(href="https://github.com/rkristelijn/login") github.com]. Log in using admin/admin | ||
| if !loggedIn | ||
| p | ||
| a(href="/") Log in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| nav(class="navbar navbar-expand-md navbar-dark bg-dark") | ||
| div(class="navbar-collapse collapse w-100 order-1 order-md-0 dual-collapse2") | ||
| ul(class="navbar-nav mr-auto") | ||
| li(class="nav-item active") | ||
| a(class="nav-link" href="/users") Users | ||
| li(class="nav-item") | ||
| a(class="nav-link" href="/about") About | ||
| div(class="mx-auto order-0") | ||
| a(class="navbar-brand mx-auto" href="/") Home | ||
| button(class="navbar-toggler" type="button" data-toggle="collapse" data-target=".dual-collapse2") | ||
| span(class="navbar-toggler-icon") | ||
| div(class="navbar-collapse collapse w-100 order-3 dual-collapse2") | ||
| ul(class="navbar-nav ml-auto") | ||
| li(class="nav-item") | ||
| a(class="nav-link" href="/logout") Logout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| extends layout | ||
|
|
||
| block content | ||
| h1= title | ||
| p Welcome to #{title} | ||
| include header | ||
| div(class="wrapper") | ||
| div(class="form-signin") | ||
| h1= title | ||
| p Welcome to #{title} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| extends layout | ||
|
|
||
| block content | ||
| include header | ||
| div(class="wrapper") | ||
| div(class="form-signin") | ||
| h1 A list of users | ||
| table(class="table") | ||
| thead | ||
| tr | ||
| th(scope="col") Username | ||
| th(scope="col") Password | ||
| tbody | ||
| each user in users | ||
| tr | ||
| td(scope="row") #{user.username} | ||
| td #{user.password} |