enter image description hereOne of my client's Opencart website have issues when open the website, a prompt alert shows following code:
Conflict
<script>document.cookie = "humans_21909=1"; document.location.reload(true)</script>
How to get this resolve. Also help me to find the files where they are located to fix it.
Had the same issue, it only happened to me when the request was something to do with "register", in my case it was "register.php", I only changed the documents name and problem was solved
You need to change the filename of register.php and its occurrences on all places in the files.
In register_modal.tpl find this part (for me 582 line):
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
Comment this alert.
Enjoy!
It might be happening because of your function name is 'register' so you need to change the function name to some other name and check it.
I appreciate all the need-to-haves that come right out of the box with Loopback.js but one area that could use some flexibility is the email verification that is sent upon user creation. This GitHub project helps illustrate this feature--but no where on SO or the Google Groups or in the documentation (yes, I checked there first) does it show how the actual text of the email verification can be changed.
I implemented the exact same code (as found at the previously referred-to GitHub project) in "verify.ejs"...namely:
<%= text %>
Right now the text that is inserted says:
Please verify your email by opening this link in a web browser:
I would like to refer to this user-interaction as "account activation"--not "email verification". The project has its own requirements that compels me to implement the change in semantics. Thank you in advance.
(You know open source rocks for so many reasons...the top reason for me right now is self-documented code.)
I looked at the source of User.verify(...) and discovered that the options which can be passed in are much more expansive than documented.
In the following code snippets (from Loopback's User model) you'll see what I mean:
options.host = options.host || (app && app.get('host')) || 'localhost';
options.port = options.port || (app && app.get('port')) || 3000;
// ### (later) ### //
options.text = options.text || 'Please verify your email by opening this link in a web browser:\n\t{href}';
options.text = options.text.replace('{href}', options.verifyHref);
So, in short, set these parameters in the options object passed in to User.verify():
var options = {
host: 'http://some.domain.com',
port: 5000,
text: 'Please activate your account by clicking on this link or copying and pasting it in a new browser window:\n\t{href}'
}
Source code for User.verify(..) found at: https://github.com/strongloop/loopback/blob/master/common/models/user.js
tx, that helped me.
to expand, the verification link options are
options.verifyHref = options.verifyHref ||
options.protocol +
'://' +
options.host +
displayPort +
options.restApiRoot +
userModel.http.path +
userModel.sharedClass.find('confirm', true).http.path +
'?uid=' +
options.user.id +
'&redirect=' +
options.redirect;
so, all the options there can be customized (particularly, options.restApiRoot was missing for me above).
alternatively, just set options.verifyHref yourself and only that one will be send as verification link
if you want just the href:
var options = {
text: '{href}'
}
On a Rails 4.x app I'm using Devise to register users. What I want to do is redirect a user after confirmation to the usual user_path(resource) but having a modal appear to prompt for a few things. I don't know how to solve this without using cookies and javascript. Anyone solved this before or know to do it using the standard after_confirmation_path_for way in Devise? If not, what do you think is the best approach to solve it?
Many thanks in advance.
Ok, so if anyone else runs into this problem. I only found one way to solve it, this is it:
confirmations_controller.rb
class ConfirmationsController < Devise::ConfirmationsController
private
def after_confirmation_path_for(resource_name, resource)
sign_in(resource)
user_path(resource[:id], cp: true)
end
end
Then in the view which I want to popup the modal, I used this fairly popular javascript answer (How can I get query string values in JavaScript?) show.html.erb:
<%= javascript_tag do -%>
window.onload = function() {
var doCP = getParameterByName('cp');
if (doCP) {
$("#modal").html("<%= escape_javascript(render 'confirm_prompt_form') %>");
$("#modal").modal("show");
}
}
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
In the upgrade guide it states
Rails 4.0 removed the ActionController::Base.asset_path option. Use the assets pipeline feature.
I am currently in the process of upgrading from Rails 3.2 to Rails 4.1. In my app I use the select2-rails gem and in my js I add an image for the select menu options:
//mycode.js.erb
function format(image) {
var image_path = "<%= asset_path('" + image.id.toLowerCase() +"') %>"
return "<img class='flag' src='" + image_path + "' />";
}
The above worked in my Rails 3.2 app but I seemed to have broken it with my upgrade to 4.1 and now receive the following error:
Sprockets::FileNotFound - couldn't find file '" + image.id.toLowerCase() +"'
Is the asset_path helper still available in Rails 4.1? If yes, any ideas on where I may have gone wrong?
Update
The code above is in my .js.erb file which allows me to have Ruby code within my js file. This currently works well in my Rails 3.2 project. I am doing this as select2 allows us to format the display of our select menu items as per the below example:
//sample.js
function format(state) {
if (!state.id) return state.text; // optgroup
return "<img class='flag' src='images/flags/" + state.id.toLowerCase() + ".png'/>" + state.text;
}
My understanding was that it is correct usage to use the asset pipeline paths rather than manually adding something like 'assets/images/icons/small'
I'm using django-tinymce together with the no grappelli branch of django-filebrowser running django 1.2.
I use the tinymce HTMLField model definition for the model field that I would like to have WYSIWYG.
I've added the correct javascript to my AdminModel, and the filebrowser works great, adding the image to the textarea with no problem, however, when I save, the textarea does not update (it looks like tinnymce doesn't touch it when it should). When I turn off the filebrowser plugin, everything works fine, so there must be some conflict with it and the TinyMCE onSubmit functionality.
I've been messing with it for while and just can't get anywhere - all of these pieces are pretty new to me, so even some ideas of what to mess with would be helpful.
Thanks in advance.
edit: Added bonus info - the default mode in the config for 'mode' was 'textareas'. When I remove that, everything saves correctly. Sadly, this also removes the image button that I'm doing all of this to have...
update
Here is the TinyMCE configuration I was using (the one included with django-filebrowser - this is broken):
tinyMCE.init({
mode: "textareas",
theme: "advanced",
language: "en",
skin: "o2k7",
browsers: "gecko",
dialog_type: "modal",
object_resizing: true,
cleanup_on_startup: true,
forced_root_block: "p",
remove_trailing_nbsp: true,
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_statusbar_location: "none",
theme_advanced_buttons1: "formatselect,bold,italic,underline,bullist,numlist,undo,redo,link,unlink,image,code,fullscreen,pasteword,media,charmap",
theme_advanced_buttons2: "",
theme_advanced_buttons3: "",
theme_advanced_path: false,
theme_advanced_blockformats: "p,h2,h3,h4,h5,h6",
width: '700',
height: '200',
plugins: "advimage,advlink,fullscreen,visualchars,paste,media,template,searchreplace",
advimage_styles: "Linksbündig neben Text=img_left;Rechtsbündig neben Text=img_right;Eigener Block=img_block",
advlink_styles: "internal (sehmaschine.net)=internal;external (link to an external site)=external",
advimage_update_dimensions_onchange: true,
file_browser_callback: "CustomFileBrowser",
relative_urls: false,
valid_elements : "" +
"-p," +
"a[href|target=_blank|class]," +
"-strong/-b," +
"-em/-i," +
"-u," +
"-ol," +
"-ul," +
"-li," +
"br," +
"img[class|src|alt=|width|height]," +
"-h2,-h3,-h4," +
"-pre," +
"-code," +
"-div",
extended_valid_elements: "" +
"a[name|class|href|target|title|onclick]," +
img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]," +
"br[clearfix]," +
"-p[class<clearfix?summary?code]," +
"h2[class<clearfix],h3[class<clearfix],h4[class<clearfix]," +
"ul[class<clearfix],ol[class<clearfix]," +
"div[class],"
});
This was one of two problems I was having - going to post an answer below as well.
The issue was actually two-fold. The first problem was the included default TinyMCE configuration that came with django-filebrowser-no-grappelli (above, in the question). I'm not sure what was wrong with it, but it prevented the actual form fields from being updated when the submit button was pushed.
When I used a custom configuration for TinyMCE, form field saving worked correctly, but the filebrowsing was broken. This was because if django-tinymce sees 'filebrowser' in the installed apps list, it overrides the file_browser_callback and sets it to 'djangoFileBrowser', so even when I correctly set it to 'CustomFileBrowser' in my own config. The solution was to explicitly tell it not to set that value. I added the follwing to my settings.py:
TINYMCE_DEFAULT_CONFIG = {
'theme': 'advanced',
'theme_advanced_toolbar_location': "top",
'theme_advanced_toolbar_align': "left",
'skin': "o2k7",
"file_browser_callback" : "CustomFileBrowser",
}
TINYMCE_FILEBROWSER = False
And everything seems to be working fine. This issue seems to be fairly unique to my combination of versions.