# GNU MediaGoblin -- federated, autonomous media hosting
-# Copyright (C) 2011 MediaGoblin contributors. See AUTHORS.
+# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# Create the user
entry = db.User()
entry.username = unicode(args.username.lower())
- entry['email'] = unicode(args.email)
- entry['pw_hash'] = auth_lib.bcrypt_gen_password_hash(args.password)
- entry['status'] = u'active'
- entry['email_verified'] = True
+ entry.email = unicode(args.email)
+ entry.pw_hash = auth_lib.bcrypt_gen_password_hash(args.password)
+ entry.status = u'active'
+ entry.email_verified = True
entry.save(validate=True)
print "User created (and email marked as verified)"
user = db.User.one({'username': unicode(args.username.lower())})
if user:
- user['is_admin'] = True
+ user.is_admin = True
user.save()
print 'The user is now Admin'
else:
user = db.User.one({'username': unicode(args.username.lower())})
if user:
- user['pw_hash'] = auth_lib.bcrypt_gen_password_hash(args.password)
+ user.pw_hash = auth_lib.bcrypt_gen_password_hash(args.password)
user.save()
print 'Password successfully changed'
else: