Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of sp.urandom.nl:application

  • Loading branch information...
commit 84a1bfc960ce7dfebf32fe2f5bc6952379d89ba9 2 parents f72024c + 649e8bc
@bertm bertm authored
View
4 application/www/backend/controllers/authenticationcontroller.php
@@ -18,7 +18,7 @@ public function actionLogin($data)
// Login.
$user = Authentication::getInstance()->login($username, $password);
- $userValues = $user->getValues(); // TODO: just get the important ones..
+ $userValues = $user->getValues();
// Add the permissions of this user to the return values.
$userValues['permissions'] = Authentication::getInstance()->getPermissionList();
@@ -58,7 +58,7 @@ public function actionKeepAlive($data)
return;
}
- $userValues = $user->getValues(); // TODO: just get the important ones..
+ $userValues = $user->getValues();
// Add the permissions of this user to the return values.
$userValues['permissions'] = Authentication::getInstance()->getPermissionList();
View
36 application/www/backend/controllers/useractivationcontroller.php
@@ -142,8 +142,6 @@ function() use ($token)
return true;
});
- // TODO: Throw an exception on failure, instead of returning false.
-
return $success;
}
@@ -155,6 +153,9 @@ function() use ($token)
*
* @param $data Should contain a boolean 'autoAccept', which is true if the setting should be
* turned on and false if it should be turned off.
+ * Additionally, if autoAccept is true, there should be a boolean 'acceptAllPending'
+ * that indicates whether all users currently waiting for activation should also be
+ * activated.
*/
public function actionSetAutoAcceptance($data)
{
@@ -163,20 +164,39 @@ public function actionSetAutoAcceptance($data)
// Fetch wheter to turn automatic acceptance on or off.
$newValue = self::getBoolean($data, 'autoAccept');
+ $acceptAll = $newValue && self::getBoolean($data, 'acceptAllPending');
// Start a transaction.
Database::getInstance()->doTransaction(
- function() use ($newValue)
+ function() use ($newValue, $acceptAll)
{
// Set the setting.
Setting::setSetting('auto-user-acceptance', $newValue ? '1' : '0');
- // If auto acceptance is turned on, accept all users waiting for acception.
- if($newValue)
+ // If requested, accept all users waiting for acception.
+ if($acceptAll)
{
- Query::update('Users', array('activationStage' => User::ACTIVE_STAGE_ACCEPTED))
- ->where('activationStage = :stage')
- ->execute(array('stage' => User::ACTIVE_STAGE_PENDING));
+ $accepted = Query::update('Users', array('activationStage' => User::ACTIVE_STAGE_ACCEPTED))
+ ->where('activationStage = :stage')
+ ->returning('userId')
+ ->execute(array('stage' => User::ACTIVE_STAGE_PENDING));
+
+ // Send activation mails.
+ foreach($accepted as $row)
+ {
+ $userId = $row->getValue('userId');
+
+ // Find associated PendingUser.
+ $puserId = Query::select('pendingUserId')
+ ->from('PendingUsers')
+ ->where('userId = :userId')
+ ->execute(array('userId' => $userId))
+ ->tryGetFirstRow()
+ ->getValue('pendingUserId');
+
+ // Send mail.
+ Mailer::sendActivationMail(new PendingUser($puserId));
+ }
}
});
}
View
4 application/www/backend/controllers/usercontroller.php
@@ -171,8 +171,6 @@ public function actionCreate($data)
'registrationDate' => time()
);
- Log::debug('!!!!!!' . $email);
-
// Check incoming values: username existance, email existance, correct pattern for
// username, correct pattern for email and no empty required fields.
if ($this->actionUsernameExists(array('username' => $username))
@@ -183,8 +181,6 @@ public function actionCreate($data)
{
throw new RegistrationFailedException('registration-failed');
}
-
- // TODO: Check lengths and website.
// Create user and pendinguser entries in a transaction.
Database::getInstance()->doTransaction(
View
2  application/www/backend/framework/database/query.php
@@ -372,6 +372,8 @@ public function returning()
}
$this->returningClause .= implode(', ', array_map(array($this, 'escapeIdentifier'), $columns));
+
+ return $this;
}
View
4 application/www/backend/util/tilepyramidbuilder.php
@@ -298,8 +298,8 @@ public function runBuilder($iterationPause = 5)
while (true)
{
- // Resolve inconsistencies every 20 rounds.
- if ($round >= 20)
+ // Resolve inconsistencies every 200 rounds.
+ if ($round >= 200)
{
$this->resolveInconsistencies();
$round = 0;
View
15 application/www/frontend/views/informationpanel.js
@@ -39,6 +39,7 @@ Ext.define('Ext.ux.BindingInformationPanel', {
var defConfig = {
border: false,
flex: 1,
+ autoHeight: true,
layout: {
type: 'vbox',
align: 'stretch'
@@ -129,6 +130,15 @@ Ext.define('Ext.ux.BindingInformationPanel', {
this.callParent();
+ // Handle authentication changes.
+ Authentication.getInstance().getEventDispatcher().bind('modelchange', this, this.onAuthenticationChange);
+
+ // Update the panel according to the current authentication.
+ this.onAuthenticationChange();
+
+ },
+ onAuthenticationChange: function()
+ {
if (Authentication.getInstance().hasPermissionTo('change-book-info'))
{
this.down("[name=modifybindingbutton]").setVisible(true);
@@ -140,8 +150,10 @@ Ext.define('Ext.ux.BindingInformationPanel', {
this.down("[name=deletebindingbutton]").setVisible(false);
}
+ // TODO : Make the layout correctly expand.
+
+ this.up('[name=informationpanel]').doLayout();
},
-
afterRender: function()
{
this.callParent();
@@ -207,6 +219,7 @@ Ext.define('Ext.ux.InformationPanel', {
{
var defConfig = {
border: false,
+ name: 'informationpanel',
layout: {
type: 'vbox',
align: 'stretch'
View
51 application/www/frontend/views/userlistpanel.js
@@ -35,12 +35,6 @@ Ext.define('Ext.ux.UserListPanel', {
change: function ()
{
var value = Ext.getCmp('autoAcceptBox').getValue();
- var changedTo = 'off';
-
- if (value)
- {
- changedTo = 'on';
- }
if (thisChange)
{
@@ -49,20 +43,39 @@ Ext.define('Ext.ux.UserListPanel', {
else
{
thisChange = true;
+
+ var message, buttons;
+ if(value)
+ {
+ message = 'You are about to turn on automatic user acceptance. '
+ + 'Do you also want to automatically accept all users '
+ + 'currently waiting for acceptance?'
+ + 'Clicking cancel will keep automatic user acceptance '
+ + 'turned off.';
+ buttons = Ext.Msg.YESNOCANCEL;
+ }
+ else
+ {
+ message = 'Are you sure you want to turn automatic user acceptance '
+ + 'off? After this, you will need to activate new users '
+ + 'manually.';
+ buttons = Ext.Msg.YESNO;
+ }
+
Ext.Msg.show({
- title: 'Are you sure?',
- msg: 'Are you sure you want to turn automatic user acceptance '
- + changedTo + '?',
- buttons: Ext.Msg.YESNO,
+ title: 'Automatic acception',
+ msg: message,
+ buttons: buttons,
icon: Ext.Msg.QUESTION,
callback: function(button)
{
- if (button == 'yes')
+ if (button == 'yes' || (value && button == 'no'))
{
RequestManager.getInstance().request(
'UserActivation',
'setAutoAcceptance',
- {autoAccept: value},
+ {autoAccept: value,
+ acceptAllPending: value && button == 'yes'},
_this,
function()
{
@@ -161,17 +174,17 @@ Ext.define('Ext.ux.UserListPanel', {
function renderDate(unixtime)
{
- var date = new Date(unixtime * 1000);
- return date.toDateString();
+ var date = new Date(unixtime * 1000);
+ return date.toDateString();
}
function renderTimestamp(unixtime)
{
- var date = new Date(unixtime * 1000);
- var h = date.getHours();
- var m = date.getMinutes();
- // TODO : lol
- return date.toDateString() + " " + ((h < 10) ? "0" : "") + h + ":" + ((m < 10) ? "0" : "") + m;
+ var date = new Date(unixtime * 1000);
+ var h = date.getHours();
+ var m = date.getMinutes();
+ // TODO : lol
+ return date.toDateString() + " " + ((h < 10) ? "0" : "") + h + ":" + ((m < 10) ? "0" : "") + m;
}
var defConfig = {
Please sign in to comment.
Something went wrong with that request. Please try again.