in Gigya, Unable to set attribute in "email" of Screen "Forget Password" in Screen-sets ID "Default-LinkAccounts" - gigya

I have the following js implemented in Gigya JavaScript Parameters:
onAfterScreenLoad: function(event) {
if ((ell = document.querySelector("#gigya-forgot-password-screen input[type=text][name=loginID]")) != null){
ell.setAttribute('type', 'email');
ell.setAttribute('placeholder', 'user#example.com');
ell.setAttribute('autocomplete', 'off');
}
},
I am able to use the above code to handle the fields of all other screen-sets EXCEPT this "Forget Password" screen (i.e. Screen ID: gigya-forgot-password-screen) in Screen-sets ID "Default-LinkAccounts".
It looks like the forgot password flow is triggered without a user session and independently of the information passed into the Email field on the login screen.
If it is, then how to implement this.

it seems the name of the field is different depending upon which screen you are using:
window.ell = document.querySelector("#gigya-register-screen input[type=text][name=email]");
window.ell = document.querySelector("#gigya-login-screen input[type=text][name=username]");
window.ell = document.querySelector("#gigya-forgot-password-screen input[type=text][name=username]");
so:
onAfterScreenLoad: function(event) {
var ell = null;
if ((event.currentScreen === "gigya-forgot-password-screen") || (event.currentScreen === "gigya-login-screen")) {
ell = document.querySelector("#" + event.currentScreen + " input[type=text][name=username]");
} else if (event.currentScreen === "gigya-register-screen") {
ell = document.querySelector("#gigya-register-screen input[type=text][name=email]");
}
if (ell != null){
ell.setAttribute('type', 'email');
ell.setAttribute('placeholder', 'user#example.com');
ell.setAttribute('autocomplete', 'off');
}
}

Related

Zend 1 ajax with dojo informatiom person

I'm working with Zend 1 with dojo and do not know how to use ajax . In my particular case that when selecting a select , whether made ​​in consultation ajax back from the database information. To enter a ID from user print the information from user by ajax.In my work I can't use jquery.
Good question!
Not is very productive work with dojo, but is possible make exactly how do you want. You will create p element with information captured in data base
In your form, add attribute 'onChange'
$form->setAttrib('onChange', 'recoveryData()');
In js file do you have a function recoveryData(), something as:
dojo.require("dojo.html");
// clean data
var myNewElement = dojo.byId('myNewElement');
if (myNewElement != null) {
dojo.empty("myNewElement");
}
dojo.xhrPost({
content: {id: dojo.attr(dojo.byId("myElement"), "value")},
url: 'your-base-path/recovery-data/',
load: function (response) {
if (response != false) {
// converte to obj
var obj = dojo.fromJson(response);
// creat new element
var node = dojo.create("span", {
innerHTML: obj.NomeServidor,
id: "myNewElement",
'class': 'row'
}
);
dojo.place(node, dojo.byId("myElement"), "after");
}
}
});
Now, you need create an Action "recoveryDataAction()" in your Controller like this:
$data = $this->getrequest()->getPost();
$id = $data['id'];
if ($this->getrequest()->isXmlHttpRequest()) {
// disable layout
$this->_helper->layout()->disableLayout();
// disable view render
$this->_helper->viewRenderer->setNoRender();
$yourTable = new Project_Model_YourTable();
$row = $yourTable->fetchRow($id);
if ($infos != null) {
echo Zend_Json::encode($row);
return;
}
echo false;
}

Confirm email in Magento using the Web-forms

I am using an extension in Magento called web-forms to create all the forms on my website. What I need to do is add the email verification fields (user must enter email twice. Both emails must match) How can I do this? I looked thru the extension but did not see a way to do it.
It looks like the web-forms is using prototype.js for validation.
I got it in case someone in the future has the same problem and in using the web-forms extension here is how you do it.
Assign css class thru the back end in magento->web-forms-(your form name)->the confirm email field(which you should create if you don't have it all ready)design tab->CSS classes for the Input element(put your class name here and remember it you are going to use it later)
Next open up in your root directory of the magento installation the validation.js file. Which is located in js/prototype/
Open the file and paste the code below after the validate-email
['[your class name]', 'Please make sure your emails match.', function(v)
{
var conf = $$('.[your class name]')[0];
var pass = false;
if ($('email')) {
pass = $('email');
}
var emailElements = $$('.validate-email');
for (var i = 0; i < emailElements.size(); i++) {
var emailElement = emailElements[i];
if (emailElement.up('form').id == conf.up('form').id) {
pass = emailElement;
}
}
if ($$('.[your class name]').size()) {
pass = $$('.validate-email')[0];
}
return (pass.value == conf.value);
}],
save it and upload it
Hope that helps somebody you has the same problem.
Above code is not working correctly following part is creating issue
if ($$('.[your class name]').size()) {
pass = $$('.validate-email')[0];
}
at my end following code is working
if ($$('.validate-admin-email').size()) {
pass = $$('.validate-admin-email')[0];
}
so the complete working code can be:
['validate-cemail', 'Please make sure your emails match.', function(v) {
var conf = $$('.validate-cemail')[0];
var pass = false;
if ($('email')) {
pass = $('email');
}
var emailElements = $$('.validate-email');
for (var i = 0; i < emailElements.size(); i++) {
var emailElement = emailElements[i];
if (emailElement.up('form').id == conf.up('form').id) {
pass = emailElement;
}
}
if ($$('.validate-admin-email').size()) {
pass = $$('.validate-admin-email')[0];
}
return (pass.value == conf.value);
}],
.validate-cemail is your defined class in template.
like:
<input type="text" name="email-confirm" id="email-confirm" class="input-text required-entry validate-cemail"/>

how to show database changes in web pages(whiteout reloading page)?

i am working on simple hotel reservation system that users enter their info, like hotel or room. in every page i have footer bar that show feedback of system when user do something. for example when user add hotel , after doing this,when he redirect to any pages, in footer bar, immediately, display , "hotel added successfully".
|----------------------------------------|
| |
| GridView |
| |
| |
|----------------------------------------|
|hotel added successfully ! |
|----------------------------------------|
the solution that i am using is :
when users log something , i log it
and i define div[id=notification] in shared/_layout, and using a worker to call a function that check log database and get new ones.
// i use worker to repeatedly invoke function to check db
var worker = new Worker('../Scripts/worker.js');
worker.addEventListener('message', function (e)
{
if (e.data != "")
{
var result = e.data;
var results = result.split("##");
if ($("#notificationID").val() != results[1])
{
$("#notificationID").val(results[1]);
}
}
}, false);
and the function to check db is
public string GetNewTrans()
{
string userName = Membership.GetUser().UserName;
using (var context = new jobEntities())
{
var query = from p in context.Logs where p.UserName==userName && p.IsNew == null orderby p.ID_Log descending select p;
if (query.Count() > 0)
{
var log = query.FirstOrDefault();
DateTime c= DateTime.Parse(log.RefreshDate.ToString());
var sec = DateTime.Now.Subtract(c).Seconds;
if( sec> 2)
{
log.IsNew = "false";
context.SaveChanges();
}
var result = log.Section + " : " + log.Action +"##"+log.Success.ToString()+"##"+log.ID_Log.ToString();
return result;
}
return null;
}
}
now i think that when number of users increase , the load of check db increase and cause to make pages slower.
so do you have any better solution ?
and my framework in asp mvc 3.5 and use EF 4.1
The better solution to get some data from db its using JsonResult action controller to get json data and than modified on the client.
As for info messages you can add TempData["message"] object in your controller and in redirecting View

How to access local paths on TYPO3 using eID

I have an image map on my frontend and from there I need to access some images that are stored on different folders under the fileadmin directory. And I'm trying to do it with eID, following this example:
[http://www.alexanderschnitzler.de/2011/06/howto-ajax-requests-with-extbase-and-fluid/][1]
But my problem is that I can only access one directory. I haven't been able to access different directories based on the user selection from my front end.
This is the code of what I been trying to do:
On my Controller I have an ajaxAction, where I need to give the full path of one directory, because I haven't figure it out how pass the directory id on to my ajaxAction, here might be my question and maybe the solution:
/**
* #return void
*/
public function ajaxAction() {
$image_file_path = "fileadmin/Images/Sattic/Amik/small";
//$image_file_path = "fileadmin/Images/Sattic/'+$id+'";
$d = dir($image_file_path) or die("Wrong path: $image_file_path");
while (false !== ($entry = $d ->read())) {
if($entry != '.' && $entry != '..' && !is_dir($dir.$entry))
$images[] = $entry;
}
$d->close();
rsort($images);
return json_encode($images);
}
On my index.html I have a map tag where the function updateImage(id) is called, when the user clicks on the different areas and my updataImage(id) function looks like this:
function updateImageGallery(id) {
console.log(id);
var ajaxUrl = "{f:uri.action(action:'ajax', pageType:'100101')}";
$.getJSON(ajaxUrl, function(data) {
var items1 = [];
var items2 = [];
$data = data;
console.log('dataLength: ' + $data.length);
console.log('dataArray: ' + $data);
$.each($data.slice(0, 4), function(key, val) {
valLink = val.replace("small.", "");
items1.push('<td><img width="145" height="145" id="" src="fileadmin/Images/Sattic/' + id +'/small/'+ val +'"/></td>');
});
$('<tr/>', {
html: items1.join('')
}).appendTo('#glRegion');
$.each($data.slice(4, 8), function(key, val) {
valLink = val.replace("small.", "");
items2.push('<td><img width="145" height="145" id="" src="fileadmin/Images/Sattic/' + id +'/small/'+ val +'"/></td>');
});
$('<tr/>', {
html: items2.join('')
}).appendTo('#glRegion');
});
return false;
}
I would like to be able to pass from updateImageGallery(id) function, the id of the directory, so I could get the images for each directory.
Is it possible to do this? I hope so, I have 30 different regions and if I solve my problem the way I'm doing now I would need to use 30 different eID's. I guess it might be a smarter way to solve this.
Any sugestions?
You can use t3lib_div::_GET('myid') to access the myid get variable.
I guess you can use var ajaxUrl = "{f:uri.action(action:'ajax',**myid:id,** pageType:'100101')}"; to set it.
Anyway, sure to generate a list of valid paths/ids inside you PHP script and check the get parameter agains those.

Remove First Name, Last Name and confirm password fields in account create page

I searched a lot to remove required fields like first name, Last name and confirm passwordfields in account create page.
So far i renamed required value from 1 to 0 from the table eav_attribute
After this i hided first name, Last Name, Confirm Password from register.phtml
But still i'm getting
The first name cannot be empty, The Last name cannot be empty, etc,..
Did any one know how to do this ?
Please give me a idea to solve this..
You have to change two more files:
Change /js/prototype/validation.js and comment out the following lines:
['validate-cpassword', 'Please make sure your passwords match.', function(v) {
var conf = $('confirmation') ? $('confirmation') : $$('.validate-cpassword')[0];
var pass = false;
if ($('password')) {
pass = $('password');
}
var passwordElements = $$('.validate-password');
for (var i = 0; i < passwordElements.size(); i++) {
var passwordElement = passwordElements[i];
if (passwordElement.up('form').id == conf.up('form').id) {
pass = passwordElement;
}
}
if ($$('.validate-admin-password').size()) {
pass = $$('.validate-admin-password')[0];
}
return (pass.value == conf.value);
}],
After that, you also have to change the Magento Customer Core model. There are two types of validation: through the front-end javascript and in the backend Customer model.
Rewrite the model with your own customer module. Then copy the validate() public function. And comment out the following lines:
$confirmation = $this->getConfirmation();
if ($password != $confirmation) {
$errors[] = Mage::helper('customer')->__('Please make sure your passwords match.');
}

Resources