python - Show That User Is Logged Into iOS app -
python - Show That User Is Logged Into iOS app -
the login works backend , goes home screen after login on ios. how do guarantee user beingness logged in?
for example, have label user's username displayed in, don't know how user's username .
i have thought can phone call server , homecoming username in json format, isn't kind of inefficient? improve way this?
ps. first time ios programmer
additional info: using flask , flask-login extension backend. using login_user(user) method. has worked in past web dev, how work ios dev.
@app.route('/login/', methods=['post']) def login(): params = json.loads(request.data) username = params['username'] password = params['password'] u = user.query.filter_by(username=username).first() if u: if utils.check_password_hash(password, u.pw_hash): login_user(u) homecoming ('', 200) else: homecoming ('', 400) else: homecoming ('', 400)
take @ parse.com's ios sdk (https://www.parse.com/docs/ios_guide#top/ios). provides login form ability utilize pfuser object determine if user logged in or not. best thing parse it's free. :)
calling [pfuser currentuser]
homecoming user that's logged in or nil if there no user.
python ios flask flask-login
Comments
Post a Comment