2015-08-18 18:34:59 +00:00
|
|
|
# Copyright 2015 Canonical, Ltd.
|
|
|
|
#
|
|
|
|
# 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 the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2016-06-22 19:19:54 +00:00
|
|
|
import logging
|
2016-07-26 02:16:46 +00:00
|
|
|
from subiquitycore.controller import BaseController
|
2016-06-30 18:17:01 +00:00
|
|
|
from subiquitycore.models import IdentityModel
|
2016-07-27 04:05:47 +00:00
|
|
|
from subiquitycore.ui.views import LoginView
|
2015-08-18 18:34:59 +00:00
|
|
|
|
2016-06-30 18:17:01 +00:00
|
|
|
log = logging.getLogger('subiquitycore.controllers.identity')
|
2015-08-18 18:34:59 +00:00
|
|
|
|
2016-07-25 02:44:51 +00:00
|
|
|
|
2016-07-27 04:05:47 +00:00
|
|
|
class BaseIdentityController(BaseController):
|
|
|
|
|
|
|
|
identity_view = None
|
|
|
|
|
2015-08-31 15:55:46 +00:00
|
|
|
def __init__(self, common):
|
|
|
|
super().__init__(common)
|
2016-06-22 19:19:54 +00:00
|
|
|
self.model = IdentityModel(self.opts)
|
2015-08-18 18:34:59 +00:00
|
|
|
|
|
|
|
def identity(self):
|
|
|
|
title = "Profile setup"
|
|
|
|
excerpt = ("Input your username and password to log in to the system.")
|
|
|
|
footer = ""
|
|
|
|
self.ui.set_header(title, excerpt)
|
2015-08-31 16:03:53 +00:00
|
|
|
self.ui.set_footer(footer, 40)
|
2016-07-27 04:05:47 +00:00
|
|
|
self.ui.set_body(self.identity_view(self.model, self.signal, self.opts))
|
2016-06-22 19:19:54 +00:00
|
|
|
|
|
|
|
def login(self):
|
|
|
|
log.debug("Identity login view")
|
2016-06-23 20:27:09 +00:00
|
|
|
title = ("Configuration Complete")
|
2016-06-22 19:19:54 +00:00
|
|
|
footer = ("View configured user and device access methods")
|
|
|
|
self.ui.set_header(title)
|
|
|
|
self.ui.set_footer(footer)
|
|
|
|
|
|
|
|
net_model = self.controllers['Network'].model
|
|
|
|
configured_ifaces = net_model.get_configured_interfaces()
|
|
|
|
login_view = LoginView(self.model,
|
|
|
|
self.signal,
|
|
|
|
self.model.user,
|
|
|
|
configured_ifaces)
|
|
|
|
|
|
|
|
self.ui.set_body(login_view)
|