Rails 4 + Storing Email address in Cookie to Remember Me - Unable to store correct email address - ruby-on-rails-4

Here, I am trying to store email address in cookie to autocomplete the email box as per last logged in user.
Rails Controller Code :-
cookies[:email] = { :value => user_email, :expires => 7.days.from_now }
For example - admin#example.com is the email address while inspecting the email address in cookie using debugger.
Its show
admin%40example.com
By using JS I tried to retrieve the email address from cookie, now in input box it show
admin%40example.com
Please suggest how to escape this symbol conversion. Thanks

%40 is encoded form of #
I you are trying autocomplete the email address from jQuery, you can use this plain javascript function to decode it:
var cookieEmail = decodeURIComponent('admin%40example.com')
$('#emailBox').val(cookieEmail)
(#emailBox is id assigned to the html element of your email input .)

Related

Exclude string from xss filter if its part of email address

In my application I have set an xss filter rule like below.
xss.filter.rule.alert=(?i)alert
But if I enter an email address with the string 'alert' in it, the alert is getting stripped.
for example myname#alerttext.com is being stripped to myname#text.com.
How can i exclude 'alert' text if it is part of a email address.

WSO2 APIM Store - limited email address validation

deploying an internal (corporate) API manager 2.0.0 we found a limitation - the email address validation apparently enforces email validation with 2-4 email :
/store/site/themes/wso2/templates/ui/validation/custom-validation.js:
$.validator.addMethod('validEmail', function(value, element) {
var emailRegex = /^([A-Za-z0-9_\-\.])+\#([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
return emailRegex.test(value);
}, i18n.t('Invalid email address'));
However - email addresses today may have even long last domain name (e.g. someuser#stad.gent, otheruse#my.internal.corporation)
I see the validation logic is implemented in the followinf file:
repository/deployment/server/jaggeryapps/store/site/themes/wso2/templates/ui/validation/custom-validation.js
Question: is the file the only place where the email format is enforced? (Users are managed in AD, so the default user view / management UI doesn't concern us too much atm)
Seems the only place where the email is validated is the script:
repository/deployment/server/jaggeryapps/store/site/themes/wso2/templates/ui/validation/custom-validation.js

Accessing Current Recipient in Sitecore 8 Email Experience Manager

How do you get the raw contact id from the ec_contact_id on the URL created by EXM?
We are using Sitecore's EXM to send emails containing links for surveys to recipients. When the recipient takes the survey we want to tie the response back to the recipient. Since EXM puts a unique Id, ec_contact_id, for the contact (encrypted) we want to use that to determine the recipient versus adding our own custom id.
We found this article, https://briancaos.wordpress.com/2015/04/27/sitecore-8-exm-get-the-email-recipient-from-a-sublayout/, and tried implementing it in the Sitecore controller that gets called when the recipient clicks on the link but the resulting recipient name comes back as empty. We don't have a "sc_item_id" value so we tried "_id" and "ec_message_id" in its place but neither value produced a valid contact Id or recipient name. We also tried looking in MongoDB with the decrypted contactId but couldn't find a match.
You could try somthing like this:
//get value of the ec_contact_id parameter for current request
string queryString = WebUtil.GetQueryString( Sitecore.Modules.EmailCampaign.GlobalSettings.AnalyticsContactIdQueryKey);
var shortID = ShortID.TryParse(queryString, out shortID);
System.Guid contactId;
// where initializationVector is System.Guid of your email message item.
using (var cryptoServiceProvider = new GuidCryptoServiceProvider(System.Text.Encoding.UTF8.GetBytes(GlobalSettings.PrivateKey), initializationVector.ToByteArray()))
{
contactId = cryptoServiceProvider.Decrypt(shortID.Guid);
}
When you create a new user in an email list, Sitecore creates a record in the xDB Mongo database. You should be able to get the email address from the users profile.
Tracker.Current.Contact.GetFacet<IContactEmailAddresses>("Emails").Entries[Tracker.Current.Contact.GetFacet<IContactEmailAddresses>("Emails").Preferred]
Tracker.Current.Contact.GetFacet<IContactEmailAddresses>("Emails").Entries["work_email"]

Redirect users to their specified email accounts with receiver and message fields pre-filled

I have an email address "myaddress#gmail.com". I have created a django form that has a text field and a button. I want to redirect anyone who types a message in the text box to their respective emails so that they can send the message they typed to "my address". This means that as they log in to their email accounts, their message boxes should already be filled with the message they typed and the receiver field should already have "myaddress#gmail.com". The problem is how to redirect the users to their email accounts and prefill the specified fields.
Can anyone help me please?
If the user has set a default email program, most of them will be triggered on mailto:. I know gmail works with mailto: as well, and its possible that other web email services might. All desktop email clients - again only if it is set as the default email program will work on mailto:
The format is:
mailto:[emailaddress]?header=value&header1=value1....&headerN=valueN
Here is an example that sets the subject of the email automatically:
Email me

How to get the sending user's id from the callback page with fb-request-form?

im sending invitation requests via the request-form to my application and i want to the sending users id from the action page. i can successfully get the ids the invitations are sent to but am not sure how to get the senders id.
im using php. this is part of my callback page:
if (isset($_REQUEST['ids'])){
$amount = sizeof($_REQUEST['ids']);
print_r($_REQUEST);
echo "<br>$amount invitations Successfully Sent";
}
the request prints out like this:
Array ( [mfs_typeahead_req_form_4cf74f96db3688507476560] => Start Typing a Name [ids] => Array ( [0] => 510149460 ) [fbs_258181898823] => \"access_token=258181898823|2.q_qb_yoReO0_xc4H8PxKRQ__.3600.1291280400-100000664203700|LqtGr_OiJTASGmek61awxmxfvFk&expires=1291280400&secret=85eTEELZj8lkV82V_PwRSA__&session_key=2.q_qb_yoReO0_xc4H8PxKRQ__.3600.1291280400-100000664203700&sig=d4cc0e4c0992ea29c0adfd60dc27185b&uid=100000664203700\" )
the id i want is 100000664203700
If using requets 2.0 http://developers.facebook.com/docs/reference/dialogs/requests/
You can get the user id form current session and append to the data parameter in the request. Facebook will send the data though as a string and you can extract on the redirect uri.
as per your print_r() Have you tried json decoding the $_REQUEST? This will give you an array to work with and you can do a quick search for uid= in your string.
http://php.net/manual/en/function.json-decode.php