Example #1
0
    def post(self):
        """
            Creates a new admin. Required post request parameters are
                uid - the new user id
                pw - the new password
                pw2 - retyping the new password.
        """
        DA = DataAccessor()

        session = getSessionByRequest(self)

        uid = self.request.get("uid")
        pw = self.request.get("pw")
        pw2 = self.request.get("pw2")

        if pw != pw2:
            setSessionMessage(session, "Your new passwords did not match. Please try again.", True)
            self.redirect("/admin")
            return

        try:
            DA.addAdmin(uid, pw)
        except Usage:
            setSessionMessage(session, "A user with that uid exists already", True)
            self.redirect("/admin")
            return

        setSessionMessage(session, "Admin: " + uid + " successfully added.", False)
        self.redirect("/admin")
Example #2
0
File: ASN2.py Project: ProCynic/asn
import sys
import wsgiref.handlers

from google.appengine.api import users
from google.appengine.ext import db
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import login_required

# Set to true if we want to have our webapp print stack traces, etc
_DEBUG = True

#default admin login
DA = DataAccessor()
try:
    DA.addAdmin('admin','000000')
except Usage:
    pass

class Login(BaseRequestHandler):
    def get(self):
        """
            Generates the login page.
        """

        session = getSessionByRequest(self)
        if (getSessionUser(session)) :
            self.redirect("/browse/")
            return

        self.generate('login.html', {