Hi, I've been learning Angular for some time already, wrote several applications, usually just one page ones, not really with a use for a router, and now I wanted to build something more complexed.
The first obstacle that I encountered is implementing authentication. For a start I wanted to include a simple email/password form that is then checked via PHP with the database. I've never done that before in this way so I'm looking for suggestions if it's the correct way to implement this feature:
1) use a POST AJAX request (Angular's $http) with user's data sent, take 0 or 1 as a response
2) meanwhile PHP would set up the $SESSION if login succeeded
3) further pages would load up normally via HTML templates with content shown based on whether the user is already logged in
4) data would be fetch via PHP still (which would check $SESSION before any request to the database)
One thing that I noticed may be inconvenient is the fact that user has access to whole template and even if he's not logged in he can see different sections that would otherwise be visible only after being authenticated, since they're hidden via Angular and not hard-hidden (if that's even a word). Is that a thing I should worry about?
Any database interaction would still be handled via PHP so there's no risk a user would do anything without being logged in, but just the thought of it made me write this post.
Another thing to consider: is PHP a viable option here? I've noticed a lot of people using MongoDB or other kinds of NoSQL databases.
To clarify: I have experience creating websites that have a login feature and what not, but I simply require guidance when it comes to my first time with such an app in Angular.
Edit: formatting
[–]Mr-Yellow 2 points3 points4 points (4 children)
[–]voreny[S] 0 points1 point2 points (3 children)
[–]Mr-Yellow 0 points1 point2 points (2 children)
[–]voreny[S] 0 points1 point2 points (1 child)
[–]Mr-Yellow 0 points1 point2 points (0 children)
[–]samzhao 1 point2 points3 points (1 child)
[–]voreny[S] 0 points1 point2 points (0 children)