How to add a login, logout, registration system to a Ionic app?


#1

Hi, I’m a newbie and I would to add a user management system to my app, but… I really don’t know how :slight_smile:

Firstly, I tried to search on Google and I found that login, logout system are always made with php+mySQL, so I found the first “secure”, free and complete system (User Cake) and I downloaded it.
User Cake has a lot of php pages, scripts and database configurations and I though to add php pages (index.php, login.php, registration.php, aminpanel.php, etc.) in /templates/ and to use the Nav Router feature of Ionic and AngularJS.
I have some questions:

  • Is it possible to use php pages instead of html templates?
    Do they work and can they used in $routeProvider as templateUrls?
  • I found a similar topic in this forum and I cannot see anything about php or mySQL.
    Is it possible (or maybe it must be) to add Login, Logout features without php scripts in Ionic?

Thanks for reading,
good winter holidays! :santa:


#2

Hey!

I think you are mixing apples with bananas:

PHP+MySQL sounds like the server-part of the application you are planing to develop.

Ionic is a client-side framework.

Two common workflows are:

  • output HTML with PHP (or any other server-side script)
  • separate client and server applications, that communicate via HTTP.

Maybe you should start at the beginning, and get some knowledge about a server-client-architecture: http://en.m.wikipedia.org/wiki/Client–server_model

fw


#3

Thank you @franzwilding :slight_smile:
Now, there’re client-side and server-side, I could achieve the first one using html, javascript, json files as databases, and the second one using php and mysql databases.

Hmm… my app will be a sort of “database reader”, the users will read informations about products and those informations (stored in online databases) could be downloaded and stored on the client every time the database will be upgraded. I could create an “items” database in phpMyAdmin and let the user to download it as “items” javascript database.

[quote]From Safari Client-Side Storage and Offline Applications Programming Guide

Beginning in Safari 3.1 and iOS 2.0, Safari supports the HTML5 JavaScript database class. The JavaScript database class, based on SQLite, provides a relational database intended for local storage of content that is too large to conveniently store in cookies (or is too important to risk accidentally deleting when the user clears out his or her cookies).

Because it provides a relational database model, the JavaScript database class makes it easy to work with complex, interconnected data in a webpage. You might use it as an alternative to storing user-generated data on the server (in a text editor, for example), or you might use it as a high-speed local cache of information the user has recently queried from a server-side database.[/quote]

The user will be able to search and view items without connection, beacuse stored in the iOS web app cache. But I would add also a login feature, to let the user to tell others which items he has, and to achieve this I’ll need to use php scripts.

Well, I found some questions related to mine:

So, if some people would to use php scripts to login or out users, there must be php pages with angularJS inside. Question: if the index page is an html one, with an angular inside, I wouldn’t be able to render php pages (and scripts), right? The same if the index page is a php one, bacuse the ng-view is client-side, not server-side, right? :frowning:

Thanks for reading,
good holidays again! :santa:


#4

You could look into products like parse.com to handle your user login system. It is very simple, straight forward and client side but I understand if you want more control over your login system.

Josh