4 Simple authorisation module for ViewGit - protects web access with pre-configured username/password.
8 1. Copy this file to <viewgitdir>/inc/auth_simple.php
9 2. Update inc/localconfig.php to use simple auth module:
11 $conf['auth_lib'] = 'simple';
12 $conf['auth_simple_users'] = array(
13 'username1'=>'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn'
14 'username2'=>'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn'
17 where nnn is the md5 of the password for each user.
19 Tip: to generate the md5, use the login page with username 'md5' and your desired password. The
20 login will fail but it will show the md5 of the entered password.
22 Released under AGPLv3 or older.
24 Developed by Topten Software (Brad Robinson)
25 http://www.toptensoftware.com
37 if (isset($_SESSION['loginname']))
41 if (isset($_REQUEST['login_action']))
43 $username=$_REQUEST['username'];
44 $password=md5($_REQUEST['password']);
45 if (isset($conf['auth_simple_users'][$username]) && $conf['auth_simple_users'][$username]==$password)
47 $_SESSION['loginname']=$username;
51 $loginmessage="MD5: ".$password;
53 $loginmessage="Login Failed";
56 $page['title']="Login - ViewGit";
59 // Not signed in, display login page
60 require('templates/header.php');
62 <h2
>Login Required
</h2
>
63 <?php
if (isset($loginmessage)):?
>
64 <p style
="border:1px solid red; padding:2px; background:#f77;"><?php
echo htmlspecialchars($loginmessage)?
><p
>
66 <form method
="POST" action
="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']) ?>">
69 <td width
="100pt">User Name
:</td
>
70 <td
><input type
="text" name
="username" id
="username"></td
>
74 <td
><input type
="password" name
="password"></td
>
78 <td
><input type
="submit" name
="login_action" value
="Login"></td
>
82 <script type
="text/javascript">
83 document
.getElementById("username").focus();
87 require('templates/footer.php');