Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How to create a login system
Started by vonncc123 May 12 2014 10:23 PM

10 replies to this topic
login database mysql
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

vonncc123

[GLOBAL: userInfoPane.html]
vonncc123
  • Contributor

  • 231 posts
  • Corona SDK

Any tips on creating a login system? on Username and Password comparison on a remote database? db is in MySQL



[TOPIC: post.html]
#2

crussell

[GLOBAL: userInfoPane.html]
crussell
  • Enthusiast

  • 91 posts
  • Corona SDK

If you're sending the data to a remote server, encrypt before sending. Also consider using HTTPS for extra security.

Depending on what's on the remote, search Google for PHP/ASP-based systems and use one of those on the server-side, then you just need to send the data from your client application and listen for the response.



[TOPIC: post.html]
#3

vonncc123

[GLOBAL: userInfoPane.html]
vonncc123
  • Contributor

  • 231 posts
  • Corona SDK

so basically I will send my username and password in encrypted mode, then the remote server will check if the username and password matches. Then the device will just receive a confirmation and it can now proceed?



[TOPIC: post.html]
#4

vonncc123

[GLOBAL: userInfoPane.html]
vonncc123
  • Contributor

  • 231 posts
  • Corona SDK

Here's what I see

 

Device Send Username Password --> Server checks -- > If yes server sends confirmation to device -->device receives confirmation --> device has now have the authorisation to use the app.



[TOPIC: post.html]
#5

crussell

[GLOBAL: userInfoPane.html]
crussell
  • Enthusiast

  • 91 posts
  • Corona SDK

That's it in a nutshell, however the server should ALWAYS send a response, either positive or negative. if you don't respond, the client could wait (in principle) forever for the server to get back to it.

The client should probably have some form of time-out set so if the server doesn't respond it's treated as an error condition something like:

Send details to server

Wait until (timeout is reached)  or (server sends response)

If timeout is reached

        Flag an error and inform the user
       Deal with the error condition

else if a response has been received

       If the response is positive
              Allow the user access

       else

              Throw an incorrect username/password condition

       end

end

 

Not the greatest pseudocode in the world but you get the idea :)



[TOPIC: post.html]
#6

vonncc123

[GLOBAL: userInfoPane.html]
vonncc123
  • Contributor

  • 231 posts
  • Corona SDK

yah got it :) thanks dude heheh :):ph34r:



[TOPIC: post.html]
#7

vonncc123

[GLOBAL: userInfoPane.html]
vonncc123
  • Contributor

  • 231 posts
  • Corona SDK

BTW in what form is the confirmation? is it in JSON? or just plain simple string variable?



[TOPIC: post.html]
#8

crussell

[GLOBAL: userInfoPane.html]
crussell
  • Enthusiast

  • 91 posts
  • Corona SDK

It'll come in whatever form you want or whatever form the server-side code returns it in - like i said, check out some of the pre-written stuff via Google - it should tell you how it returns it's data...  



[TOPIC: post.html]
#9

vonncc123

[GLOBAL: userInfoPane.html]
vonncc123
  • Contributor

  • 231 posts
  • Corona SDK

The only thing is I don't know how to send data to the server :( sorry from mobile to server, but I can retrieve data from the server via JSON http://coronalabs.com/blog/2012/11/20/how-to-download-json-data-from-mysql-using-corona-sdk/



[TOPIC: post.html]
#10

vonncc123

[GLOBAL: userInfoPane.html]
vonncc123
  • Contributor

  • 231 posts
  • Corona SDK

nvm i got it how to communicate with remote server thanks a lot though :)



[TOPIC: post.html]
#11

davidhagen

[GLOBAL: userInfoPane.html]
davidhagen
  • Enthusiast

  • 47 posts
  • Corona SDK

I've done an app recently which requires login. Here are few tips I would like to add to this topic

 

1> use https connection to send and receive data.

2> use POST  in network request instead of GET. I used GET in my app and Apache was recording query string(&password=123123). By default Apache doesn't record POST parameter.

3> from device pass unique key and check from your server that's the request is from your App.

4> working with json seems to easy to work. I uses Rob's  function to save and load json file into lua table. (Thank you Rob)

5> always check networking connection before network request. I use Rob's code found in the business app. (Thank you Rob)

6> encrypting parameter.. I've not done myself yet but will do in the next release

7> in the server end make sure you catch all errors and time to time review logs




[topic_controls]
[/topic_controls]