GithubHelp home page GithubHelp logo

daftmonk / angular-passport Goto Github PK

View Code? Open in Web Editor NEW
241.0 17.0 88.0 335 KB

AngularJS + Express application that demonstrates: Authentication with Passport, CRUD interface for creating posts with mongoDB, server and client validations for account creation, and authorization for editing posts.

License: MIT License

JavaScript 96.09% CSS 3.91%

angular-passport's Introduction

Angular-Passport

An AngularJS application that uses Express, Passport, MongoDB. Demonstrating:

  • Authentication using Passport
  • Account creation and server validation with Mongoose.
  • CRUD interface for creating posts with MongoDB
  • Client validations for account creation including a directive for validating if a username is available.
  • Authorization middleware for checking if you are allowed to edit a post.
  • Unit tests for client code

Live Example

Try out the app: http://angular-passport.herokuapp.com (Heroku app may have gone to sleep, reload the page if it doesn't work.)

How to use angular-passport

Before you continue, make sure you have MongoDB installed http://www.mongodb.org/downloads/.

Setup

Run npm install, followed by bower install to grab the dependencies.

Running the app

Run grunt server to start the app in development mode with livereload, or run grunt server:dist to run it in a minified and optimized production build.

Testing

Run grunt test to start the karma test runner.

Directory structure

+---server.js           -> Bootstrap Server
|
+---app                 -> Client
|   +---scripts
|   |   +---controllers
|   |   +---directives
|   |   \---services
|   |
|   +---styles
|   \---views
|       \---partials
|           \---blogs
+---lib                 -> Server
|   +---config
|   +---controllers
|   +---db
|   \---models
|           
+---test                -> Client unit tests

angular-passport's People

Contributors

daftmonk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-passport's Issues

User cookie undefined when cached content is used

I relied heavily on this boilerplate project to set up my first Angular/Express app: thank you!

I've run into a problem on my project where sometimes I'll go to a page and my app things I'm not logged in, though I have an active session. If I reload the page, it immediately thinks I'm logged in again. I was able to stumble onto consistent reproduction steps today, and they work on this repo out of the box, with no modifications other than a console.log one line 5 of app/scripts/services/Auth.js.

login-problem

To reproduce the issue, log in, then go to a page outside the app. Then use your browser's back button to return to your app. You'll find the user cookie is undefined, and the app thinks you're not logged in. If you reload the page, things are fine.

This is because the cookie that gets set here isn't actually being called.

I'm going to try to solve this problem on my own, now, but I wanted to let you know about it and get the thoughts of a wiser mind than my own on the best way to fix it. I don't fully understand the reason for removing the cookie and getting it reset each time.

Please let me know if I can provide any more details, and thanks again for making this project!

Asking for log in when direct linking or refreshing on blogs page

Hello DaftMonk,

Thank you so much for making this. It's been a great help with a personal project of mine.

I have one issue with this however, not a deal breaker at all but it would be nice for a solution.

If you were to direct link to http://angular-passport.herokuapp.com/blogs or if you go to that URL and refresh the page when you're not logged in, it will prompt you to log in (throwing a 401 error). However, if you started from the home page and click on the Blogs link, it will not ask you to log in.

I've been trying to figure it out on my own, but I'm having a hard time. Is there a way we can make it so that it doesn't prompt you to log in if you direct link or when you hit refresh on the page.

Thanks in advanced!

app.router is deprecated

I noticed that you had app.use(app.router). However, this will give traceback when logging errors:

Error: 'app.router' is deprecated!

I think you can use express.Router(); instead

bcrypt installation fails

During npm install bcrypt installation fails. I feel it's due to I don't have visual studio. May be using bcrypt-nodejs is helpful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.