]> source.dussan.org Git - nextcloud-server.git/commitdiff
add support for apps to register alternative login methods
authorThomas Mueller <thomas.mueller@tmit.eu>
Tue, 29 Jan 2013 16:28:08 +0000 (17:28 +0100)
committerThomas Mueller <thomas.mueller@tmit.eu>
Tue, 29 Jan 2013 16:28:08 +0000 (17:28 +0100)
below the standard login a list of icons/button will be displayed

core/templates/login.php
lib/app.php
lib/util.php

index c82d2cafa2e2c4c08fa893776899476800102993..7616b93f9a5c9d411e0175cee8e943072a5307bb 100644 (file)
                <input type="submit" id="submit" class="login primary" value="<?php echo $l->t('Log in'); ?>"/>
        </fieldset>
 </form>
-<?php OCP\Util::addscript('core', 'visitortimezone'); ?>
+<?php if (!empty($_['alt_login'])) { ?>
+<form>
+       <fieldset>
+               <legend style="margin-bottom: 20px;"><?php echo $l->t('Alternative Logins:') ?></legend>
+               <ul>
+                       <? foreach($_['alt_login'] as $login): ?>
+                               <li style="height: 40px;"><a class="button" href="<?php echo $login['href']; ?>" ><?php echo $login['name']; ?></a></li>
+                               <?php endforeach; ?>
+               </ul>
+       </fieldset>
+</form>
+<?php } ?>
+
+<?php
+OCP\Util::addscript('core', 'visitortimezone');
 
index 108226fc1a1a5074070ce8fe35c7fc5fc4caeb5f..36e2983722cd49a0f2d383783e2e6c723a509ca2 100644 (file)
@@ -36,6 +36,7 @@ class OC_App{
        static private $appTypes = array();
        static private $loadedApps = array();
        static private $checkedApps = array();
+       static private $altLogin = array();
 
        /**
         * @brief loads all apps
@@ -557,6 +558,14 @@ class OC_App{
                self::$personalForms[]= $app.'/'.$page.'.php';
        }
 
+       public static function registerLogIn($entry) {
+               self::$altLogin[] = $entry;
+       }
+
+       public static function getAlternativeLogIns() {
+               return self::$altLogin;
+       }
+
        /**
         * @brief: get a list of all apps in the apps folder
         * @return array or app names (string IDs)
index 374baa43dbe0a7c04cd859905ce3145a78ce66e6..eaa8c69e2235033331047880cb77c6a56484fa17 100755 (executable)
@@ -312,6 +312,8 @@ class OC_Util {
                        $redirect_url = OC_Util::sanitizeHTML($_REQUEST['redirect_url']);
                        $parameters['redirect_url'] = urlencode($redirect_url);
                }
+
+               $parameters['alt_login'] = OC_App::getAlternativeLogIns();
                OC_Template::printGuestPage("", "login", $parameters);
        }