Skip to content
Permalink
Browse files

finish and document Limited mode

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed May 9, 2015
1 parent 87e83a2 commit ce0aeffabb61d3710d7f53ae35aac7ce179fef04
@@ -0,0 +1,53 @@
{# -*- coding: utf-8 -*- #}
{% extends 'base.tmpl' %}
{% block content %}
<div class="page-header">
<h1>Account <tt>{{ current_user.username }}</tt></h1>
</div>

{% if alert %}
<div class="alert alert-{{ alert_status }}" role="alert">{{ alert }}</div>
{% endif %}

<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Profile</h3>
</div>
<div class="panel-body">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Real name</label>
<div class="col-sm-10"><input class="form-control" id="realname" name="realname" value="{{ current_user.realname }}" placeholder="Real name" required disabled></div>
</div>
<div class="form-group">
<label for="name" class="col-sm-2 control-label">E-mail address</label>
<div class="col-sm-10"><input class="form-control" id="email" name="email" type="email" value="{{ current_user.email }}" placeholder="E-mail address" required disabled></div>
</div>
</div>
</div>

<form action="{{ url_for('acp_pwdhash') }}" method="POST" class="form-horizontal">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Password change</h3>
</div>
<div class="panel-body">
<p>In order to change your password, please consult your site
administrator and provide them with a <strong>hash</strong> of your
password. Generate a secure hash below.</p>
<div class="form-group">
<label for="newpwd1" class="col-sm-2 control-label">New password</label>
<div class="col-sm-10"><input type="password" class="form-control" id="newpwd1" name="newpwd1" placeholder="New password"></div>
</div>
<div class="form-group">
<label for="newpwd2" class="col-sm-2 control-label">Repeat password</label>
<div class="col-sm-10"><input type="password" class="form-control" id="newpwd2" name="newpwd2" placeholder="Repeat new password"></div>
</div>
</div>
</div>
{{ form.csrf_token }}
<div style="text-align: center;">
<button type="submit" class="btn btn-primary btn-lg save-btn"><i class="fa fa-key fa-fw"></i> Generate hash</button>
</div>
</form>

{% endblock %}
@@ -0,0 +1,39 @@
{# -*- coding: utf-8 -*- #}
{% extends 'base.tmpl' %}
{% block content %}
<div class="page-header">
<h1>Account <tt>{{ current_user.username }}</tt></h1>
</div>

<form action="{{ url_for('acp_pwdhash') }}" method="POST" class="form-horizontal">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Password change</h3>
</div>
{% if status %}
<div class="panel-body">
<p class="text-success">Please provide the following hash to your
administrator:</p>
<p><code>{{ pwdhash }}</code></p>
</div>
{% else %}
<div class="panel-body">
<p class="text-danger">The passwords did not match. Please try again.</p>
<div class="form-group">
<label for="newpwd1" class="col-sm-2 control-label">New password</label>
<div class="col-sm-10"><input type="password" class="form-control" id="newpwd1" name="newpwd1" placeholder="New password"></div>
</div>
<div class="form-group">
<label for="newpwd2" class="col-sm-2 control-label">Repeat password</label>
<div class="col-sm-10"><input type="password" class="form-control" id="newpwd2" name="newpwd2" placeholder="Repeat new password"></div>
</div>
</div>
</div>
{{ form.csrf_token }}
<div style="text-align: center;">
<button type="submit" class="btn btn-primary btn-lg save-btn"><i class="fa fa-key fa-fw"></i> Generate hash</button>
</div>
{% endif %}
</form>

{% endblock %}
@@ -25,13 +25,11 @@
$(document).ready(function() {
fs = $('.build-status-icon');
fsc = $('.build-status-caption');
if ({{ bstatus }} == 1) {
if ({{ status }} == 1) {
fs.removeClass('fa-cog');
fs.addClass('fa-check');
fsc.addClass('text-success');
clearInterval(intID);
} else {
pb.addClass('progress-bar-danger');
fs.removeClass('fa-cog');
fs.addClass('fa-times');
fsc.addClass('text-danger');
@@ -0,0 +1,53 @@
## -*- coding: utf-8 -*-
<%inherit file="base.tmpl"/>
<%block name="content">
<div class="page-header">
<h1>Account <tt>${current_user.username}</tt></h1>
</div>

% if alert:
<div class="alert alert-${alert_status}" role="alert">${alert}</div>
% endif

<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Profile</h3>
</div>
<div class="panel-body">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Real name</label>
<div class="col-sm-10"><input class="form-control" id="realname" name="realname" value="${current_user.realname}" placeholder="Real name" required disabled></div>
</div>
<div class="form-group">
<label for="name" class="col-sm-2 control-label">E-mail address</label>
<div class="col-sm-10"><input class="form-control" id="email" name="email" type="email" value="${current_user.email}" placeholder="E-mail address" required disabled></div>
</div>
</div>
</div>

<form action="${url_for('acp_pwdhash')}" method="POST" class="form-horizontal">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Password change</h3>
</div>
<div class="panel-body">
<p>In order to change your password, please consult your site
administrator and provide them with a <strong>hash</strong> of your
password. Generate a secure hash below.</p>
<div class="form-group">
<label for="newpwd1" class="col-sm-2 control-label">New password</label>
<div class="col-sm-10"><input type="password" class="form-control" id="newpwd1" name="newpwd1" placeholder="New password"></div>
</div>
<div class="form-group">
<label for="newpwd2" class="col-sm-2 control-label">Repeat password</label>
<div class="col-sm-10"><input type="password" class="form-control" id="newpwd2" name="newpwd2" placeholder="Repeat new password"></div>
</div>
</div>
</div>
${form.csrf_token}
<div style="text-align: center;">
<button type="submit" class="btn btn-primary btn-lg save-btn"><i class="fa fa-key fa-fw"></i> Generate hash</button>
</div>
</form>

</%block>
@@ -0,0 +1,39 @@
## -*- coding: utf-8 -*-
<%inherit file="base.tmpl"/>
<%block name="content">
<div class="page-header">
<h1>Account <tt>${current_user.username}</tt></h1>
</div>

<form action="${url_for('acp_pwdhash')}" method="POST" class="form-horizontal">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Password change</h3>
</div>
% if status:
<div class="panel-body">
<p class="text-success">Please provide the following hash to your
administrator:</p>
<p><code>${pwdhash}</code></p>
</div>
% else:
<div class="panel-body">
<p class="text-danger">The passwords did not match. Please try again.</p>
<div class="form-group">
<label for="newpwd1" class="col-sm-2 control-label">New password</label>
<div class="col-sm-10"><input type="password" class="form-control" id="newpwd1" name="newpwd1" placeholder="New password"></div>
</div>
<div class="form-group">
<label for="newpwd2" class="col-sm-2 control-label">Repeat password</label>
<div class="col-sm-10"><input type="password" class="form-control" id="newpwd2" name="newpwd2" placeholder="Repeat new password"></div>
</div>
</div>
</div>
${form.csrf_token}
<div style="text-align: center;">
<button type="submit" class="btn btn-primary btn-lg save-btn"><i class="fa fa-key fa-fw"></i> Generate hash</button>
</div>
% endif
</form>

</%block>
@@ -25,13 +25,11 @@
$(document).ready(function() {
fs = $('.build-status-icon');
fsc = $('.build-status-caption');
if (${bstatus} == 1) {
if (${status} == 1) {
fs.removeClass('fa-cog');
fs.addClass('fa-check');
fsc.addClass('text-success');
clearInterval(intID);
} else {
pb.addClass('progress-bar-danger');
fs.removeClass('fa-cog');
fs.addClass('fa-times');
fsc.addClass('text-danger');
@@ -73,11 +73,19 @@ class UserImportForm(Form):
"""A user import form."""
tsv = FileField("TSV File")


class UserEditForm(Form):
"""A user editor form, used for CSRF protection only."""
pass



class PermissionsForm(Form):
"""A permissions form, used for CSRF protection only."""
pass


class PwdHashForm(Form):
"""A password hash form."""
newpwd1 = TextField('New password', validators=[Required()])
newpwd2 = TextField('Repeat new password', validators=[Required()])
@@ -88,7 +88,7 @@ def orphans(dburl, sitedir):
job = get_current_job(db)
job.meta.update({'out': '', 'return': None, 'status': None})
job.save()
returncode, out = orphans_single()
returncode, out = orphans_single(default_exec=True)

job.meta.update({'out': out, 'return': returncode, 'status':
returncode == 0})
@@ -102,15 +102,25 @@ def build_single(mode):
amode = ['-a']
else:
amode = []
p = subprocess.Popen([executable, '-m', 'nikola', 'build'] + amode,
if executable.endswith('uwsgi'):
# hack, might fail in some environments!
_executable = executable[:-5] + 'python'
else:
_executable = executable
p = subprocess.Popen([_executable, '-m', 'nikola', 'build'] + amode,
stderr=subprocess.PIPE)
p.wait()
out = ''.join(p.stderr.readlines())
return (p.returncode == 0), out

def orphans_single():
def orphans_single(default_exec=False):
"""Remove all orphans in the site, in the single user-mode."""
p = subprocess.Popen([executable, '-m', 'nikola', 'orphans'],
if not default_exec and executable.endswith('uwsgi'):
# default_exec => rq => sys.executable is sane
_executable = executable[:-5] + 'python'
else:
_executable = executable
p = subprocess.Popen([_executable, '-m', 'nikola', 'orphans'],
stdout=subprocess.PIPE)
p.wait()
files = [l.strip() for l in p.stdout.readlines()]

0 comments on commit ce0aeff

Please sign in to comment.
You can’t perform that action at this time.