Esempio n. 1
0
 def get(self):
     if not login_using_local():
         return self.error(404)
     continue_to = self.request.get('continue_to', '')
     google_login_url = users.create_login_url(continue_to)
     using_google = login_using_google()
     return self.render('signin.html', locals())
Esempio n. 2
0
 def post(self):
     if not login_using_local():
         return self.error(404)
     email = self.request.get('email')
     password = self.request.get('password')
     continue_to = self.request.get('continue_to', '/')
     
     google_login_url = users.create_login_url(continue_to)
     errors = []
     local_user = UserAuth.gql('WHERE email=:1', email).get()
     if local_user and self.authenticate(local_user, password):
         login_user = local_user.get_user()
         profile = Profile.gql('WHERE user = :1', login_user).get()
         if not profile:
             created, profile = Profile.get_or_create_from_user(login_user)
             if created:
                 self.redirect('/profile/edit')
         return self.redirect(continue_to)
     else:
         errors.append('Login error, please relogin again')
     using_google = login_using_google()
     return self.render('signin.html', locals())