Popravki pri registraciji in trgovini
This commit is contained in:
parent
f1f9f7049f
commit
9a6ad82bb4
@ -21,6 +21,8 @@ class ApiLogin
|
||||
|
||||
var $prijava = '';
|
||||
|
||||
var $data;
|
||||
|
||||
var $EncPass;
|
||||
|
||||
var $page_urls = []; // Url-ji za podstrani - to se bo verjetno nastavljalo v settings.php
|
||||
@ -310,6 +312,9 @@ class ApiLogin
|
||||
if (isset($data['method'])){
|
||||
$this->method = $data['method'];
|
||||
}
|
||||
if (isset($data)){
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
if (!isset($params['action'])) {
|
||||
$response = 'Napaka! Manjkajo parametri!';
|
||||
@ -1160,19 +1165,27 @@ class ApiLogin
|
||||
|
||||
$error = [];
|
||||
|
||||
$email = (isset($_POST['email'])) ? $_POST['email'] : '';
|
||||
$ime = (isset($_POST['ime'])) ? $_POST['ime'] : '';
|
||||
$geslo = (isset($_POST['geslo'])) ? $_POST['geslo'] : '';
|
||||
$geslo2 = (isset($_POST['geslo2'])) ? $_POST['geslo2'] : '';
|
||||
$agree = (isset($_POST['agree'])) ? $_POST['agree'] : '0';
|
||||
$gdprAgree = (isset($_POST['gdpr-agree'])) ? $_POST['gdpr-agree'] : '0';
|
||||
$ajaxKlic = (isset($_POST['ajax'])) ? $_POST['ajax'] : '0'; // Če izvajamo registracjo preko drupala, ker se pošlje post request preko ajaxa
|
||||
$email = (isset($this->data['email'])) ? $this->data['email'] : '';
|
||||
$ime = (isset($this->data['ime'])) ? $this->data['ime'] : '';
|
||||
$geslo = (isset($this->data['geslo'])) ? $this->data['geslo'] : '';
|
||||
$geslo2 = (isset($this->data['geslo2'])) ? $this->data['geslo2'] : '';
|
||||
$agree = (isset($this->data['agree'])) ? $this->data['agree'] : '0';
|
||||
$gdprAgree = (isset($this->data['gdpr-agree'])) ? $this->data['gdpr-agree'] : '0';
|
||||
$ajaxKlic = (isset($this->data['ajax'])) ? $this->data['ajax'] : '0'; // Če izvajamo registracjo preko drupala, ker se pošlje post request preko ajaxa
|
||||
|
||||
$varnostno_polje = (isset($_POST['varnostno-polje'])) ? $_POST['varnostno-polje'] : false;
|
||||
if (!empty($varnostno_polje)) {
|
||||
|
||||
if($this->method == 'AJAX'){
|
||||
return $this->ajaxResponse('error', [
|
||||
'url' => $this->page_urls['page_robot_redirect'],
|
||||
'message' => 'Robot'
|
||||
]);
|
||||
} else {
|
||||
header('Location: ' . $this->page_urls['page_robot_redirect']);
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Preverimo ReCaptcha
|
||||
@ -1185,7 +1198,6 @@ class ApiLogin
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Preverimo ce imamo vse podatke
|
||||
if ($email == '') {
|
||||
$error['missing_email'] = '1';
|
||||
@ -1247,11 +1259,11 @@ class ApiLogin
|
||||
// Nekaj ni ok - posljemo na isto stran z errorji v GET-u
|
||||
if (!empty($error)) {
|
||||
|
||||
if($ajaxKlic){
|
||||
echo json_encode($this->preveriNapake($error));
|
||||
die();
|
||||
if($ajaxKlic || $this->method == 'AJAX'){
|
||||
return $this->ajaxResponse('error', $this->preveriNapake($error));
|
||||
}
|
||||
|
||||
|
||||
// Ime in email posljemo nazaj v urlju
|
||||
$params = 'email='.$email.'&ime='.$ime.'&gdpr='.$gdprAgree.'&';
|
||||
|
||||
@ -1266,11 +1278,8 @@ class ApiLogin
|
||||
} // Vse je ok - preusmerimo na potrditveno stran
|
||||
else {
|
||||
|
||||
if($ajaxKlic){
|
||||
echo json_encode([
|
||||
'success' => '1'
|
||||
]);
|
||||
die();
|
||||
if($ajaxKlic || $this->method == 'AJAX'){
|
||||
return $this->ajaxResponse('success');
|
||||
}
|
||||
|
||||
// Hidden form, ki ga z js potem postamo naprej (da prenesemo vnesene podatke na naslednjo stran)
|
||||
@ -1306,7 +1315,7 @@ class ApiLogin
|
||||
}
|
||||
|
||||
if(is_numeric($language)){
|
||||
include_once('../../lang/'.$language.'.php');
|
||||
include('../../lang/'.$language.'.php');
|
||||
}
|
||||
|
||||
$napaka = [];
|
||||
@ -1393,25 +1402,25 @@ class ApiLogin
|
||||
global $app_settings;
|
||||
|
||||
|
||||
$email = (isset($_POST['email']) ? $_POST['email'] : '');
|
||||
$ime = (isset($_POST['ime']) ? $_POST['ime'] : '');
|
||||
//$geslo = (isset($_POST['geslo']) ? base64_decode($_POST['geslo']) : '');
|
||||
$geslo = (isset($_POST['geslo']) ? $_POST['geslo'] : '');
|
||||
$gdprAgree = (isset($_POST['gdpr-agree']) ? $_POST['gdpr-agree'] : 0);
|
||||
$ajax = (isset($_POST['ajax']) ? $_POST['ajax'] : 0); // če je Drupal ajax request
|
||||
$email = (isset($this->data['email']) ? $this->data['email'] : '');
|
||||
$ime = (isset($this->data['ime']) ? $this->data['ime'] : '');
|
||||
//$geslo = (isset($this->data['geslo']) ? base64_decode($this->data['geslo']) : '');
|
||||
$geslo = (isset($this->data['geslo']) ? $this->data['geslo'] : '');
|
||||
$gdprAgree = (isset($this->data['gdpr-agree']) ? $this->data['gdpr-agree'] : 0);
|
||||
$ajax = (isset($this->data['ajax']) ? $this->data['ajax'] : 0); // če je Drupal ajax request
|
||||
|
||||
|
||||
// Nastavimo jezik
|
||||
$language = 1;
|
||||
if(isset($_POST['language'])){
|
||||
$language = $_POST['language'];
|
||||
if(isset($this->data['language'])){
|
||||
$language = $this->data['language'];
|
||||
}
|
||||
elseif(isset($_POST['jezik'])){
|
||||
$language = ($_POST['jezik'] == 'en' ? 2 : 1);
|
||||
elseif(isset($this->data['jezik'])){
|
||||
$language = ($this->data['jezik'] == 'en' ? 2 : 1);
|
||||
}
|
||||
|
||||
if(is_numeric($language)){
|
||||
include_once('../../lang/'.$language.'.php');
|
||||
include('../../lang/'.$language.'.php');
|
||||
}
|
||||
|
||||
|
||||
@ -1527,11 +1536,8 @@ class ApiLogin
|
||||
}
|
||||
|
||||
|
||||
if($ajax){
|
||||
echo json_encode([
|
||||
'success' => 1
|
||||
]);
|
||||
die();
|
||||
if($ajax || $this->method == 'AJAX'){
|
||||
return $this->ajaxResponse('success');
|
||||
}
|
||||
|
||||
|
||||
@ -2040,7 +2046,7 @@ class ApiLogin
|
||||
}
|
||||
}
|
||||
|
||||
private function ajaxResponse($type, $data)
|
||||
private function ajaxResponse($type, $data = [])
|
||||
{
|
||||
echo json_encode([
|
||||
'type' => $type,
|
||||
|
@ -20,7 +20,7 @@
|
||||
</div>
|
||||
|
||||
<div class="w-form">
|
||||
<form name="registracija" id="registracija-uporabnika" class="{{ jezik }}" action="{{ register_url }}" method="post">
|
||||
<div name="registracija" id="registracija-uporabnika" class="{{ jezik }}" action="{{ register_url }}" method="post">
|
||||
<input type="hidden" name="jezik" value="{{ jezik }}"/>
|
||||
|
||||
<div class="w-clearfix">
|
||||
@ -89,7 +89,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
33
frontend/drupal9/web/themes/custom/pro1ka/js/nakupovanje.js
Normal file
33
frontend/drupal9/web/themes/custom/pro1ka/js/nakupovanje.js
Normal file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* JS povezani z nakupom
|
||||
*/
|
||||
(function ($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
|
||||
jQuery('.cas-trajanja .mesec').on('click', function(){
|
||||
|
||||
var trajanje = jQuery('[name="trajanje"]:checked').val();
|
||||
|
||||
jQuery('#prikazTrajanjeSt').text(trajanje);
|
||||
|
||||
var mesecIme = jQuery('#prikazTrajanjeMesec').attr('data-text');
|
||||
|
||||
if(trajanje == 1){
|
||||
mesecIme = mesecIme.substring(0, mesecIme.length-2);
|
||||
} else if(trajanje == 3){
|
||||
mesecIme = mesecIme.substring(0, mesecIme.length-1);
|
||||
}
|
||||
|
||||
jQuery('#prikazTrajanjeMesec').text(mesecIme);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
@ -273,14 +273,16 @@
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var sendVariables = jQuery('#registracija-uporabnika').serialize();
|
||||
var sendVariables = jQuery('#registracija-uporabnika :input').serialize();
|
||||
sendVariables += '&ajax=1';
|
||||
|
||||
jQuery.post('/frontend/api/api.php?action=register', sendVariables, function (data) {
|
||||
jQuery.post('/api/drupal/register', sendVariables, function (data) {
|
||||
jQuery('.napaka-registracija').hide();
|
||||
|
||||
var response = JSON.parse(data);
|
||||
jQuery('.error-field').removeClass('error-field');
|
||||
|
||||
if (response.success && response.success == 1) {
|
||||
if (response.type && response.type == 'success') {
|
||||
jQuery('#reg-confirm-email').text(jQuery('#register-form [name="email"]').val());
|
||||
jQuery('#reg-confirm-ime').text(jQuery('#register-form [name="ime"]').val());
|
||||
jQuery('#reg-confirm-geslo').text('****');
|
||||
@ -309,11 +311,12 @@
|
||||
|
||||
} else {
|
||||
// Izpišemo napake
|
||||
if (response.napaka && response.napaka.length > 0) {
|
||||
if(response.type == 'error') {
|
||||
if (response.data.napaka && response.data.napaka.length > 0) {
|
||||
jQuery('.napaka-registracija').show();
|
||||
|
||||
var napake = '';
|
||||
jQuery.each(response.napaka, function (key, val) {
|
||||
jQuery.each(response.data.napaka, function (key, val) {
|
||||
napake += '<div>' + val + '</div>';
|
||||
});
|
||||
|
||||
@ -332,9 +335,10 @@
|
||||
jQuery('#register-form [name="geslo"]').addClass('error-field');
|
||||
jQuery('#register-form [name="geslo2"]').addClass('error-field');
|
||||
}
|
||||
}
|
||||
|
||||
if (response.new_username.length > 0) {
|
||||
jQuery('#register-form #registracija-vzdevek').val(response.new_username);
|
||||
if (response.data.new_username.length > 0) {
|
||||
jQuery('#register-form #registracija-vzdevek').val(response.data.new_username);
|
||||
}
|
||||
|
||||
//Ponastavi reCaptcho
|
||||
@ -356,13 +360,13 @@
|
||||
jQuery('#reg-confirm-next').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var sendVariables = jQuery('#registracija-uporabnika').serialize();
|
||||
var sendVariables = jQuery('#registracija-uporabnika :input').serialize();
|
||||
sendVariables += '&ajax=1';
|
||||
|
||||
jQuery.post('/frontend/api/api.php?action=register_confirm', sendVariables, function (data) {
|
||||
jQuery.post('/api/drupal/register_confirm', sendVariables, function (data) {
|
||||
var response = JSON.parse(data);
|
||||
|
||||
if (response.success && response.success == 1) {
|
||||
if (response.type && response.type == 'success') {
|
||||
var text = jQuery('#register-form-email-sent').html().replace("SFMAIL", jQuery('#reg-confirm-email').text());
|
||||
jQuery('#register-form-email-sent').html(text);
|
||||
|
||||
|
@ -10,6 +10,7 @@ global-styling:
|
||||
# js/enka-21.js: {}
|
||||
js/script.js: {}
|
||||
js/login.js: {}
|
||||
js/nakupovanje.js: {}
|
||||
js/modernizr-custom.js: {}
|
||||
|
||||
dependencies:
|
||||
|
@ -163,6 +163,21 @@
|
||||
margin-top: -10px;
|
||||
}
|
||||
|
||||
|
||||
.registracija {
|
||||
#gdpr-vec-text {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
#register-form-confirm{
|
||||
display: none;
|
||||
}
|
||||
|
||||
#register-form-email-sent {
|
||||
display: none;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -246,6 +261,7 @@
|
||||
background: #ff000024;
|
||||
padding: 0.25rem 0.75rem;
|
||||
color: red;
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@ -328,3 +344,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
<h1 class="slider-title">Do dragocenih vpogledov z enim klikom</h1>
|
||||
<p class="slider-subtitle">ZMOGLJIVO, HITRO IN ENOSTAVNO ORODJE ZA ANKETIRANJE</p>
|
||||
<div class="buttons-row">
|
||||
<a href="#" class="button main-button w-inline-block">
|
||||
<a href="{% if uporabnik %}/admin/survey{% else %}#{% endif %}" class="button main-button w-inline-block {% if uporabnik is empty %}modal-goto-registration{% endif %}">
|
||||
<div class="button-flyin main" style="transform: translate3d(-100%, 0px, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skew(0deg, 0deg); transform-style: preserve-3d; display: block;"></div>
|
||||
<div class="button-label">Ustvarite brezplačno anketo</div>
|
||||
<img src="/tema1ka/svg/icons8-chevron-right-bela.svg" loading="lazy" alt="" class="button-right-arrow" style="transform: translate3d(0px, 0px, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skew(0deg); transform-style: preserve-3d;">
|
||||
@ -294,7 +294,7 @@
|
||||
{# Gumb #}
|
||||
<div class="row flex-desna flex">
|
||||
<div class="gumb">
|
||||
<a href="#" class="button shrink main-button w-inline-block" class="ustvari-anketo">
|
||||
<a href="{% if uporabnik %}/admin/survey{% else %}#{% endif %}" class="button shrink main-button w-inline-block" class="ustvari-anketo">
|
||||
<div class="button-label">Ustvarite anketo</div>
|
||||
<img src="/tema1ka/svg/icons8-chevron-right-bela.svg" loading="lazy" class="button-right-arrow">
|
||||
<div class="button-flyin"></div>
|
||||
@ -356,7 +356,7 @@
|
||||
<div class="row flex">
|
||||
<div class="col c-33 gumb">
|
||||
<div class="buttons-row buttons-center" style="width: 200px">
|
||||
<a href="#" class="button main-button w-inline-block">
|
||||
<a href="{% if uporabnik %}/admin/survey{% else %}#{% endif %}" class="button main-button w-inline-block">
|
||||
<div class="button-label">Ustvarite anketo</div><img src="/tema1ka/svg/icons8-chevron-right-bela.svg" loading="lazy" alt="" class="button-right-arrow" style="transform: translate3d(0px, 0px, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skew(0deg, 0deg); transform-style: preserve-3d;">
|
||||
<div class="button-flyin" style="transform: translate3d(-100%, 0px, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skew(0deg, 0deg); transform-style: preserve-3d; display: block;"></div>
|
||||
</a>
|
||||
|
@ -292,9 +292,17 @@
|
||||
<div class="desna">
|
||||
<div class="dleva">
|
||||
<h3>Informacije o naročilu</h3>
|
||||
<h4>{% if paket == 2 %} Paket 2ka {% else %} Paket 3ka {% endif %}</h4>
|
||||
X mesece
|
||||
<h4>Način plačila: XZY</h4>
|
||||
<h4>
|
||||
{% if paket == 2 %}
|
||||
Paket <span id="prikazStPaketa">2</span>ka
|
||||
{% else %}
|
||||
Paket <span id="prikazStPaketa">3</span>ka
|
||||
{% endif %}
|
||||
</h4>
|
||||
<div class="prikazTrajanje">
|
||||
<span id="prikazTrajanjeSt"></span> <span id="prikazTrajanjeMesec" data-text="mesecev"></span>
|
||||
</div>
|
||||
<h4>Način plačila: <span id="prikazNacinPlacila"></span></h4>
|
||||
{% if language.id == 'sl' %}
|
||||
<div class="text-small">*Naročnina se zaračuna v enkratnem znesku.</div>
|
||||
{% else %}
|
||||
|
@ -6,7 +6,7 @@
|
||||
<div class="div-block-17">
|
||||
<h3 class="side-title">Orodje za anketiranje 1KA lahko z omejenimi funkcionalnostmi preizkusite tudi brezplačno</h3>
|
||||
<div class="buttons-row">
|
||||
<a href="#" class="button main-button-white shrink w-inline-block">
|
||||
<a href="{% if uporabnik %}/admin/survey{% else %}#{% endif %}" class="button main-button-white shrink w-inline-block {% if uporabnik is empty%}modal-goto-registration{% endif %}">
|
||||
<div class="button-label">Preizkusite</div><img src="/tema1ka/svg/icons8-chevron-right.svg" loading="lazy" alt="" class="button-right-arrow">
|
||||
<div class="button-flyin main"></div>
|
||||
</a>
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
|
||||
{# LOGO #}
|
||||
<a href="/" class="inline-block 1ka-clearfix">
|
||||
<a href="/d/{{ language.id }}" class="inline-block 1ka-clearfix">
|
||||
<img src="/tema1ka/svg/1ka_logo_{{ language.id ?? 'sl' }}.svg" loading="lazy" alt="Logo 1ka" class="logo">
|
||||
</a>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user