Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google App Engine using UserProperty to link data

I am writing an application in GAE. In order to link the currently logged in user to data in my application I have been relying on equality between users.get_current_user() and members.user (see model below). Where I run into trouble is when the user signs in with an email address using different capitalization than his/her initial login ([email protected] != [email protected]). What is the most reliable way to link the current user to application specific data?

class members(db.Model):
    firstName=db.StringProperty(verbose_name='First Name',required=True)
    lastName=db.StringProperty(verbose_name='Last Name',required=True)
    user=db.UserProperty()
like image 955
garnertb Avatar asked Sep 06 '26 03:09

garnertb


1 Answers

Don't use the username - call user.user_id(), and compare on that. It's guaranteed to remain the same, even if nickname or email address change.

like image 55
Nick Johnson Avatar answered Sep 07 '26 16:09

Nick Johnson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!