Exemplo n.º 1
0
    def create(self, data):
        # create user
        user = CrowdUser(data['name'], data['login'], data['login'])

        # set password
        user.password = ptah.passwordTool.encode(data['password'])
        Session.add(user)
        Session.flush()

        return user
Exemplo n.º 2
0
Arquivo: user.py Projeto: mcdonc/ptah
    def create(self):
        data, errors = self.extract()

        if errors:
            self.message(errors, 'form-error')
            return

        # create user
        user = CrowdUser(data['name'], data['login'], data['login'])
        # set password
        user.password = ptah.passwordTool.encode(data['password'])
        Session.add(user)
        Session.flush()

        self.request.registry.notify(PrincipalAddedEvent(user))

        self.message('User has been created.', 'success')
        raise HTTPFound(location='./')