diff --git a/src/yasi_applets/disks/__init__.py b/src/yasi_applets/disks/__init__.py new file mode 100644 index 0000000..d9ee8c2 --- /dev/null +++ b/src/yasi_applets/disks/__init__.py @@ -0,0 +1,7 @@ +from flask import Blueprint + +bp = Blueprint('disks', __name__, + template_folder='') + +from yasi_applets.disks import routes + diff --git a/src/yasi_applets/disks/disks.html b/src/yasi_applets/disks/disks.html new file mode 100644 index 0000000..5af5b2f --- /dev/null +++ b/src/yasi_applets/disks/disks.html @@ -0,0 +1,155 @@ +{% extends "layout.html" %} +{% block body %} + +
How would you like to install Debian?
+ +
Proposed layout:
+ {{ disk['name'] }} ({{(disk['size']/1024000000)|round(0)|int }} GB) - Serial: {{ disk['serial'] }}
+ {{ child['name'] }} ({{ (child['size']/1024000000)|round(2) }} GiB) {{ child['mountpoint'] }}
+ {{ child['fstype'] }}
+ {{ disk['name'] }} ({{ (disk['size']/1024000000)|round(2) }} GiB) /dev/{{ disk['name'] }}
+ swap
+
Would you like fries with that?
+ +Date / time. / timezone
Install additional firmware.
+ + Installing... + +
+ +
+ Installing system, the rest of the process is automated. +
+ +
+
+
Would you like fries with that?
+ +The Popularity Contest (popcon) is a programme where anonymous data is sent back to Debian, tracking the number of packages installed. More information can be obtained at https://popcon.debian.org.
Would you like to install a graphical environment for this system?
+ +Ready to install! Please review all changes.
+ +This is the last chance to back out before committing to install, please ensure all the details are correct.
+ +That username is not available
') + else: + return('That username is available
') + build_summary() + return("") + + +@bp.route('/users/password-check/', methods=['GET', 'POST', 'PUT']) +def check_password(): + if request.method == 'POST': + password = request.form["password"] + password_confirm = request.form["password_confirm"] + current_app.config['CONFIG']['recipe']['users']['users'][0]['password'] = password + current_app.config['CONFIG']['recipe']['users']['users'][0]['password_confirm'] = password_confirm + if password != password_confirm: + return('Passwords do not match
') + else: + return('Passwords match
') + build_summary() + return("") + + +def build_stringlist(): + """ + Return all the strings that is used in this applet. + """ + string_dict = {} + string_dict['menu_item'] = _("Users") + string_dict['initial_user_text'] = _("Let's set up an initial user.") + string_dict['full_name'] = _("Full Name") + string_dict['user_name'] = _("Username") + string_dict['user_name_hint'] = _("One word, all lowercase") + string_dict['user_name_available'] = _("This username is available") + string_dict['user_name_not_available'] = _("This username is not available") + string_dict['user_name_reserved'] = _("This username is reserved by the system") + string_dict['user_name_characters'] = _("The username must be one word, lowercase, with no special characters") + string_dict['password'] = _("Password") + string_dict['password_confirm'] = _("Password (confirm)") + string_dict['password_nomatch'] = _("These passwords do now match") + string_dict['password_tooshort'] = _("This password is too short") + return string_dict + + +def build_menu(): + """ + Define menu items and paths. + """ + current_app.config['CONFIG']['settings']['menu']['users'] = (build_stringlist()['menu_item'], "/users", 20) + print(current_app.config['CONFIG']['settings']['menu']) + + +def build_summary(): + """ + Write up a summary of what this module will do. + """ + current_app.config['CONFIG']['Summary']['users'] = {} + current_app.config['CONFIG']['Summary']['users']['heading'] = "Users and Identity" + current_app.config['CONFIG']['Summary']['users']['bleh'] = current_app.config['CONFIG']['recipe']['popcon']['enable_popcon'] + current_app.config['CONFIG']['Summary']['users']['settings'] = current_app.config['CONFIG']['recipe']['users']['users'] + current_app.config['CONFIG']['Summary']['users']['text'] = "Add primary user with the username: " + str(current_app.config['CONFIG']['recipe']['users']['users'][0]['username']) + return("ok?") + +build_menu() diff --git a/src/yasi_applets/users/routes.py.bak b/src/yasi_applets/users/routes.py.bak new file mode 100644 index 0000000..2dfbc4f --- /dev/null +++ b/src/yasi_applets/users/routes.py.bak @@ -0,0 +1,24 @@ +from applets.software import bp +from flask import Flask, request, session, redirect, \ + url_for, render_template, flash, Blueprint +# we use this neat little trick to get config data from the main app +from flask import current_app + + +def build_stringlist(): + """ + Return all the strings that is used in this applet. + """ + string_dict = {} + string_dict['initial_user_text'] = _("Let's set up an initial user.") + string_dict['full_name'] = _("Full Name") + string_dict['user_name'] = _("Username") + string_dict['user_name_available'] = _("This username is available") + string_dict['user_name_not_available'] = _("This username is not available") + string_dict['user_name_reserved'] = _("This username is reserved by the system") + string_dict['user_name_characters'] = _("The username must be one word, lowercase, with no special characters") + string_dict['password'] = _("Password") + string_dict['password_confirm'] = _("Password (confirm)") + string_dict['password_nomatch'] = _("These passwords do now match") + string_dict['password_tooshort'] = _("This password is too short") + return string_dict diff --git a/src/yasi_applets/users/static/img/avatar-default.svg b/src/yasi_applets/users/static/img/avatar-default.svg new file mode 100644 index 0000000..4e08bb5 --- /dev/null +++ b/src/yasi_applets/users/static/img/avatar-default.svg @@ -0,0 +1,22 @@ + + diff --git a/src/yasi_applets/users/users.html b/src/yasi_applets/users/users.html new file mode 100644 index 0000000..17a4705 --- /dev/null +++ b/src/yasi_applets/users/users.html @@ -0,0 +1,73 @@ +{% extends "layout.html" %} +{% block body %} + +{{ string_dict['initial_user_text'] }}
+ +