Exemplo n.º 1
0
    def get(self):
        from models import users as U
        from utils import cryptography as c
        u = U.User(parent=U.users_key())

        username = "******"
        password = "******"

        u.username = username
        u.pw_hash = c.make_pw_hash(username, password)
        u.user_type = 'admin'
        u.personal = U.Personal(
            first_name="Daniel",
            last_name="Bok",
            mobile_number='12345678',
            email='*****@*****.**',
            postal_code='487372',
            address='8 Somapah Road'
        )

        if not U.User.by_name(u.username):
            u.put()
            self.redirect('/login')
        else:
            self.write("Already Done")
Exemplo n.º 2
0
 def register(cls, name, pw):
     pw_hash = c.make_pw_hash(name, pw)
     return User(parent=users_key(),
                 username=name,
                 pw_hash=pw_hash)