mirror of
https://github.com/cydrobolt/polr.git
synced 2024-11-09 19:52:28 +01:00
Merge branch 'gurgeng-master'
This commit is contained in:
commit
4ed599f1f1
@ -22,7 +22,7 @@ class SetupController extends Controller {
|
||||
|
||||
private static function setupAlreadyRan() {
|
||||
return view('error', [
|
||||
'message' => 'Sorry, but you have already ran the setup script previously.'
|
||||
'message' => 'Sorry, but you have already completed the setup process.'
|
||||
]);
|
||||
}
|
||||
|
||||
@ -112,6 +112,8 @@ class SetupController extends Controller {
|
||||
$st_index_redirect = $request->input('setting:index_redirect');
|
||||
$st_redirect_404 = $request->input('setting:redirect_404');
|
||||
$st_password_recov = $request->input('setting:password_recovery');
|
||||
$st_restrict_email_domain = $request->input('setting:restrict_email_domain');
|
||||
$st_allowed_email_domains = $request->input('setting:allowed_email_domains');
|
||||
|
||||
$st_base = $request->input('setting:base');
|
||||
$st_auto_api_key = $request->input('setting:auto_api_key');
|
||||
@ -155,6 +157,8 @@ class SetupController extends Controller {
|
||||
'ST_INDEX_REDIRECT' => $st_index_redirect,
|
||||
'ST_REDIRECT_404' => $st_redirect_404,
|
||||
'ST_PASSWORD_RECOV' => $st_password_recov,
|
||||
'ST_RESTRICT_EMAIL_DOMAIN' => $st_restrict_email_domain,
|
||||
'ST_ALLOWED_EMAIL_DOMAINS' => $st_allowed_email_domains,
|
||||
|
||||
'MAIL_ENABLED' => $mail_enabled,
|
||||
'MAIL_HOST' => $mail_host,
|
||||
|
@ -68,6 +68,15 @@ class UserController extends Controller {
|
||||
$password = $request->input('password');
|
||||
$email = $request->input('email');
|
||||
|
||||
if (env('SETTING_RESTRICT_EMAIL_DOMAIN')) {
|
||||
$email_domain = explode('@', $email)[1];
|
||||
$permitted_email_domains = explode(',', env('SETTING_ALLOWED_EMAIL_DOMAINS'));
|
||||
|
||||
if (!in_array($email_domain, $permitted_email_domains)) {
|
||||
return redirect(route('signup'))->with('error', 'Sorry, your email\'s domain is not permitted to create new accounts.');
|
||||
}
|
||||
}
|
||||
|
||||
$ip = $request->ip();
|
||||
|
||||
$user_exists = UserHelper::userExists($username);
|
||||
|
10
public/js/SetupCtrl.js
Normal file
10
public/js/SetupCtrl.js
Normal file
@ -0,0 +1,10 @@
|
||||
polr.controller('SetupCtrl', function($scope) {
|
||||
$scope.init = function () {
|
||||
$('[data-toggle="popover"]').popover({
|
||||
trigger: "hover",
|
||||
placement: "right"
|
||||
});
|
||||
};
|
||||
|
||||
$scope.init();
|
||||
});
|
@ -1,6 +0,0 @@
|
||||
$(function () {
|
||||
$('[data-toggle="popover"]').popover({
|
||||
trigger: "hover",
|
||||
placement: "right"
|
||||
});
|
||||
});
|
@ -77,6 +77,12 @@ SETTING_PSEUDORANDOM_ENDING={{$ST_PSEUDOR_ENDING}}
|
||||
# Set to true to record advanced analytics
|
||||
SETTING_ADV_ANALYTICS={{$ST_ADV_ANALYTICS}}
|
||||
|
||||
# Set to true to restrict registration to a specific email domain
|
||||
SETTING_RESTRICT_EMAIL_DOMAIN={{$ST_RESTRICT_EMAIL_DOMAIN}}
|
||||
|
||||
# A comma-separated list of permitted email domains
|
||||
SETTING_ALLOWED_EMAIL_DOMAINS={{$ST_ALLOWED_EMAIL_DOMAINS}}
|
||||
|
||||
# Set each to blank to disable mail
|
||||
@if($MAIL_ENABLED)
|
||||
MAIL_DRIVER=smtp
|
||||
|
@ -18,7 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html ng-app="polr">
|
||||
<head>
|
||||
<title>Polr @yield('title')</title>
|
||||
@yield('css')
|
||||
|
@ -14,7 +14,7 @@ Setup
|
||||
<a class="navbar-brand" href="/">Polr</a>
|
||||
</div>
|
||||
|
||||
<div class='row'>
|
||||
<div class="row" ng-controller="SetupCtrl" class="ng-root">
|
||||
<div class='col-md-3'></div>
|
||||
|
||||
<div class='col-md-6 setup-body well'>
|
||||
@ -174,6 +174,21 @@ Setup
|
||||
<option value='no-verification'>Enabled, no email verification required</option>
|
||||
</select>
|
||||
|
||||
<p>
|
||||
Restrict Registration Email Domains:
|
||||
<button data-content="Restrict registration to certain email domains." type="button" class="btn btn-xs btn-default setup-qmark" data-toggle="popover">?</button>
|
||||
</p>
|
||||
<select name='setting:restrict_email_domain' class='form-control'>
|
||||
<option value='false'>Allow any email domain to register</option>
|
||||
<option value='true'>Restrict email domains allowed to register</option>
|
||||
</select>
|
||||
|
||||
<p>
|
||||
Permitted Email Domains:
|
||||
<button data-content="A comma-separated list of emails permitted to register." type="button" class="btn btn-xs btn-default setup-qmark" data-toggle="popover">?</button>
|
||||
</p>
|
||||
<input type='text' class='form-control' name='setting:allowed_email_domains' placeholder='company.com,company-corp.com'>
|
||||
|
||||
<p>
|
||||
Password Recovery:
|
||||
<button data-content="Password recovery allows users to reset their password through email." type="button" class="btn btn-xs btn-default setup-qmark" data-toggle="popover">?</button>
|
||||
@ -236,5 +251,7 @@ Setup
|
||||
|
||||
@section('js')
|
||||
<script src="/js/bootstrap.min.js"></script>
|
||||
<script src='/js/setup.js'></script>
|
||||
<script src='/js/angular.min.js'></script>
|
||||
<script src='/js/base.js'></script>
|
||||
<script src='/js/SetupCtrl.js'></script>
|
||||
@endsection
|
||||
|
Loading…
Reference in New Issue
Block a user