Page Menu
Home
GitPull.it
Search
Configure Global Search
Log In
Files
F13209949
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
17 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/view/user.php b/view/user.php
index bb7df4c69..21dec0089 100644
--- a/view/user.php
+++ b/view/user.php
@@ -1,102 +1,104 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
-
+if (User::isLogged() && !empty($_GET['redirectUri'])) {
+ header("Location: {$_GET['redirectUri']}");
+}
$tags = User::getTags(User::getId());
$tagsStr = "";
foreach ($tags as $value) {
$tagsStr .= "<span class=\"label label-{$value->type} fix-width\">{$value->text}</span>";
}
//$json_file = url_get_contents("{$global['webSiteRootURL']}plugin/CustomizeAdvanced/advancedCustom.json.php");
// convert the string to a json object
//$advancedCustom = json_decode($json_file);
?>
<!DOCTYPE html>
<html lang="<?php echo $_SESSION['language']; ?>">
<head>
<title><?php echo $config->getWebSiteTitle(); ?> :: <?php echo __("User"); ?></title>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/Croppie/croppie.css" rel="stylesheet" type="text/css"/>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/Croppie/croppie.min.js" type="text/javascript"></script>
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/bootstrap-fileinput/css/fileinput.min.css" rel="stylesheet" type="text/css"/>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/bootstrap-fileinput/js/fileinput.min.js" type="text/javascript"></script>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php include $global['systemRootPath'] . 'view/include/navbar.php'; ?>
<div class="container-fluid">
<?php
if (User::isLogged()) {
$user = new User("");
$user->loadSelfUser();
?>
<div class="row">
<div>
<form class="form-compact well form-horizontal" id="updateUserForm" onsubmit="">
<?php echo $tagsStr; ?>
<fieldset>
<legend>
<?php echo __("Update your user") ?>
</legend>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#basicInfo" id="aBasicInfo"><?php echo __("Basic Info") ?></a></li>
<?php if (empty($advancedCustomUser->disablePersonalInfo)) { ?>
<li><a data-toggle="tab" href="#personalInfo" id="aPersonalInfo"><?php echo __("Personal Info") ?></a></li>
<?php } ?>
<?php echo AVideoPlugin::profileTabName($user->getId()); ?>
</ul>
<div class="tab-content">
<div id="basicInfo" class="tab-pane fade in active" style="padding: 10px 0;">
<?php
include $global['systemRootPath'] . './view/userBasicInfo.php';
?>
</div>
<?php if (empty($advancedCustomUser->disablePersonalInfo)) { ?>
<div id="personalInfo" class="tab-pane fade" style="padding: 10px 0;">
<?php
include $global['systemRootPath'] . './view/userPersonalInfo.php';
?>
</div>
<?php } ?>
<?php echo AVideoPlugin::profileTabContent($user->getId()); ?>
</div>
<!-- Button -->
<div class="form-group">
<hr>
<div class="col-md-12">
<center>
<button type="submit" class="btn btn-primary btn-block btn-lg" ><?php echo __("Save"); ?> <span class="fa fa-save"></span></button>
</center>
</div>
</div>
</fieldset>
</form>
</div>
</div>
<?php
} else {
include $global['systemRootPath'] .'./view/userLogin.php';
}
?>
</div><!--/.container-->
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
</body>
</html>
diff --git a/view/userLogin.php b/view/userLogin.php
index 60c0acad1..96b2a1bf6 100644
--- a/view/userLogin.php
+++ b/view/userLogin.php
@@ -1,213 +1,248 @@
<?php
if (empty($_COOKIE) && empty($_GET['cookieLogin'])) {
- // TODO implement a popup login for cross domain cookie block
+ // TODO implement a popup login for cross domain cookie block
}
if (empty($_GET['redirectUri'])) {
if (!empty($_SERVER["HTTP_REFERER"])) {
// if comes from the streamer domain
if (preg_match('#^' . $global['webSiteRootURL'] . '#i', $_SERVER["HTTP_REFERER"]) === 1) {
$_GET['redirectUri'] = $_SERVER["HTTP_REFERER"];
}
}
}
+if (empty($_COOKIE)) {
+ ?>
+ <div style="padding: 10px;">
+ <div class="alert alert-warning">
+ <h1><i class="fas fa-exclamation-circle"></i> <?php echo __("Login Alert"); ?></h1>
+ <h2><?php echo __("Please Login in the window pop up"); ?></h2>
+
+ <button class="btn btn-block btn-warning" onclick="openLoginWindow()"><i class="fas fa-sign-in-alt"></i> <?php echo __("Open pop-up Login window"); ?></button><br>
+ <?php echo __("In case the login window does not open, check how do I disable the pop-up blocker in your browser"); ?>:<br>
+ <a href="https://support.mozilla.org/en-US/kb/pop-blocker-settings-exceptions-troubleshooting" target="_blank">Mozilla Firefox</a><br>
+ <a href="https://support.google.com/chrome/answer/95472" target="_blank">Google Chrome</a>
+
+ </div>
+ </div>
+ <script>
+ function openLoginWindow(){
+ win = window.open('<?php echo $global['webSiteRootURL']; ?>user?redirectUri=<?php print isset($_GET['redirectUri']) ? $_GET['redirectUri'] : ""; ?>', 'Login Page', "width=640,height=480,scrollbars=no");
+ }
+ var win;
+ openLoginWindow();
+ var logintimer = setInterval(function () {
+ if (win.closed) {
+ clearInterval(logintimer);
+ document.location = "<?php print isset($_GET['redirectUri']) ? $_GET['redirectUri'] : $global['webSiteRootURL']; ?>";
+ }
+ }, 1000);
+ $(document).ready(function () {
+ if (!win || win.closed || typeof win.closed == 'undefined') {
+ swal("<?php echo __("Sorry!"); ?>", "<?php echo __("In order to enjoy our login feature, you need to allow our pop-ups in your browser."); ?>", "error");
+ }
+ });
+ </script>
+ <?php
+ return false;
+}
?>
<div class="row">
<div class="hidden-xs col-sm-2 col-md-3 col-lg-4"></div>
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4 list-group-item ">
<fieldset>
<legend class=" hidden-xs"><?php echo __("Please sign in"); ?></legend>
<?php
if (empty($advancedCustomUser->disableNativeSignIn)) {
?>
<form class="form-compact well form-horizontal" id="loginForm">
<input type="hidden" name="redirectUri" value=""/>
<div class="form-group">
<label class="col-sm-4 control-label hidden-xs"><?php echo __("User"); ?></label>
<div class="col-sm-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input id="inputUser" placeholder="<?php echo!empty($advancedCustomUser->forceLoginToBeTheEmail) ? "me@example.com" : __("User"); ?>" class="form-control" type="text" value="" required >
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label hidden-xs"><?php echo __("Password"); ?></label>
<div class="col-sm-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
<input id="inputPassword" placeholder="<?php echo __("Password"); ?>" class="form-control" type="password" value="" >
</div>
</div>
</div>
<?php
$captcha = User::getCaptchaForm();
?>
<div class="form-group captcha" style="<?php echo User::isCaptchaNeed() ? "" : "display: none;" ?>" id="captchaForm">
<?php echo $captcha; ?>
</div>
<div class="form-group">
<div class="col-sm-4"></div>
<div class="col-sm-8">
<div class="pull-left" style="margin-right: 10px;">
<div class="material-switch">
<input id="inputRememberMe" class="form-control" type="checkbox">
<label for="inputRememberMe" class="label-success"></label>
</div>
</div>
<label class="pull-left"><?php echo __("Remember me"); ?></label>
</div>
</div>
<div class="form-group">
<div class="col-xs-12 inputGroupContainer">
<?php
if (empty($advancedCustomUser->disableNativeSignUp)) {
?>
<small><a href="#" class="btn btn-block" id="forgotPassword"><?php echo __("I forgot my password"); ?></a></small>
<?php
}
?>
</div>
</div>
<!-- Button -->
<div class="form-group">
<div class="col-md-12">
<button type="submit" class="btn btn-success btn-block" id="mainButton" ><span class="fas fa-sign-in-alt"></span> <?php echo __("Sign in"); ?></button>
</div>
</div>
</form>
<?php
if (empty($advancedCustomUser->disableNativeSignUp)) {
?>
<div class="row">
<div class="col-md-12">
<a href="signUp?redirectUri=<?php print isset($_GET['redirectUri']) ? $_GET['redirectUri'] : ""; ?>" class="btn btn-primary btn-block" ><span class="fa fa-user-plus"></span> <?php echo __("Sign up"); ?></a>
</div>
</div>
<?php
}
}
?>
<hr>
<?php
$login = AVideoPlugin::getLogin();
foreach ($login as $value) {
if (is_string($value) && file_exists($value)) { // it is a include path for a form
include $value;
} else if (is_array($value)) {
?>
<div class="col-md-6">
<a href="login?type=<?php echo $value['parameters']->type; ?>&redirectUri=<?php print isset($_GET['redirectUri']) ? $_GET['redirectUri'] : ""; ?>" class="<?php echo $value['parameters']->class; ?>" ><span class="<?php echo $value['parameters']->icon; ?>"></span> <?php echo $value['parameters']->type; ?></a>
</div>
<?php
}
}
?>
<hr>
</fieldset>
<?php
if (!empty($advancedCustomUser->messageToAppearBelowLoginBox->value)) {
echo "<div class='alert alert-info'>";
echo $advancedCustomUser->messageToAppearBelowLoginBox->value;
echo "</div>";
}
?>
</div>
<div class="hidden-xs col-sm-2 col-md-3 col-lg-4"></div>
</div>
<script>
$(document).ready(function () {
<?php
if (!empty($_GET['error'])) {
?>
swal("<?php echo __("Sorry!"); ?>", "<?php echo addslashes($_GET['error']); ?>", "error");
<?php
}
?>
$('#loginForm').submit(function (evt) {
evt.preventDefault();
<?php
if (!empty($advancedCustomUser->forceLoginToBeTheEmail)) {
?>
var email = $("#inputUser").val();
if (!validateEmail(email) && email.toLowerCase() !== "admin") {
// if the user is admin, let it go
//swal("<?php echo __("Sorry!"); ?>", "<?php echo __("The username must be an email"); ?>", "error");
//return false;
}
<?php
}
?>
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/login.json.php',
data: {"user": $('#inputUser').val(), "pass": $('#inputPassword').val(), "rememberme": $('#inputRememberMe').is(":checked"), "captcha": $('#captchaText').val(), "redirectUri": "<?php print isset($_GET['redirectUri']) ? $_GET['redirectUri'] : ""; ?>"},
type: 'post',
success: function (response) {
if (!response.isLogged) {
modal.hidePleaseWait();
if (response.error) {
swal("<?php echo __("Sorry!"); ?>", response.error, "error");
} else {
swal("<?php echo __("Sorry!"); ?>", "<?php echo __("Your user or password is wrong!"); ?>", "error");
}
if (response.isCaptchaNeed) {
$("#btnReloadCapcha").trigger('click');
$('#captchaForm').slideDown();
}
} else {
document.location = response.redirectUri;
}
}
});
});
$('#forgotPassword').click(function () {
var user = $('#inputUser').val();
if (!user) {
swal("<?php echo __("Sorry!"); ?>", "<?php echo __("You need to inform what is your user!"); ?>", "error");
return false;
}
var capcha = '<span class="input-group-addon"><img src="<?php echo $global['webSiteRootURL']; ?>captcha?<?php echo time(); ?>" id="captcha"></span><span class="input-group-addon"><span class="btn btn-xs btn-success" id="btnReloadCapcha"><span class="glyphicon glyphicon-refresh"></span></span></span><input name="captcha" placeholder="<?php echo __("Type the code"); ?>" class="form-control" type="text" style="height: 60px;" maxlength="5" id="captchaText2">';
var span = document.createElement("span");
span.innerHTML = "<?php echo __("We will send you a link, to your e-mail, to recover your password!"); ?>" + capcha;
swal({
title: "<?php echo __("Are you sure?"); ?>",
content: span,
icon: "warning",
buttons: true,
dangerMode: true,
})
.then((willDelete) => {
if (willDelete) {
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/userRecoverPass.php',
data: {"user": $('#inputUser').val(), "captcha": $('#captchaText2').val()},
type: 'post',
success: function (response) {
if (response.error) {
swal("<?php echo __("Error"); ?>", response.error, "error");
} else {
swal("<?php echo __("E-mail sent"); ?>", "<?php echo __("We sent you an e-mail with instructions"); ?>", "success");
}
modal.hidePleaseWait();
}
});
}
});
$('#btnReloadCapcha').click(function () {
$('#captcha').attr('src', '<?php echo $global['webSiteRootURL']; ?>captcha?' + Math.random());
$('#captchaText').val('');
});
});
});
</script>
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Wed, Apr 22, 15:11 (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1862833
Default Alt Text
(17 KB)
Attached To
Mode
R58 TurboFlop
Attached
Detach File
Event Timeline
Log In to Comment