is it possible to create a website and hybrid app (using ionic) with same codebase without rewriting anything - node.js

I want to create a website along with its hybrid app using Ionic, I checked ionic's documentation http://ionicframework.com/getting-started/, I created an ionic app for tabs but I also want to handle my website with it so that if the request is coming from web then normal HTML should be served with web frameworks like foundation and I dont want to repeat the code for mobile and web. when I checked the files generated by ionic, it looked like this
<ion-modal-view>
<ion-header-bar>
<h1 class="title">Login</h1>
<div class="buttons">
<button class="button button-clear" ng-click="closeLogin()">Close</button>
</div>
</ion-header-bar>
<ion-content>
<form ng-submit="doLogin()">
<div class="list">
<label class="item item-input">
<span class="input-label">Username</span>
<input type="text" ng-model="loginData.username">
</label>
<label class="item item-input">
<span class="input-label">Password</span>
<input type="password" ng-model="loginData.password">
</label>
<label class="item">
<button class="button button-block button-positive" type="submit">Log in</button>
</label>
</div>
</form>
</ion-content>
</ion-modal-view>
So is it possible to use the same code for web and app(foundation for web and ionic for app)

yes you can!
you can use ionic platform add browser
then you need to add to your node js server.
Ionic as a web server

Related

Spline Animation disappears when deploying

I made a 3D design using Spline and I added to my application, when I run the application locally using
npm run build it works perfectly I can see the design and everything. However, when I try to deploy the application on the internet the Spline design will disappear I don't understand why this is happening, I have deployed the application to Vercel, Firebase, and Heroku. My application is a React app with Node.js.
<div className="relative" id="home">
<Spline scene="https://prod.spline.design/0TUuMfCgXS3Xkkuo/scene.splinecode" />
<div className="absolute bottom-10 w-full flex justify-center items-center">
<div className="shadow-md p-4 flex items-center justify-center bg-zinc-900 rounded-3xl ">
<p className="text-white">Press and drag to orbit</p>
</div>
</div>
</div>
It works with iFrames without server-side rendering. You have to wrap it inside a component. You can import that component with dynamic from 'next/dynamic':
const IFrameComponent = dynamic(() => import('path/to/component'), {
ssr: false,
})

Moneris - Setting up a Test Hosting Pay Page

I'm trying to make a fix to a moneris website, but I have to change the mode of moneris to test to test the changes before pushing in production.
I'm trying the code on the example page as is and got an error. "Invalid store credentials."
<FORM METHOD="POST" ACTION= https://esqa.moneris.com/HPPDP/index.php >
<INPUT TYPE="HIDDEN" NAME="ps_store_id" VALUE="AF4Fs1024">
<INPUT TYPE="HIDDEN" NAME="hpp_key" VALUE="Hsjh4GSr4g">
<INPUT TYPE="HIDDEN" NAME="charge_total" VALUE="1.00">
<!--MORE OPTIONAL VARIABLES CAN BE DEFINED HERE -->
<INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Click to proceed to Secure Page">
</FORM>
So if this is not how you can make a test payment to test the process, how can you?
PS: Seems there's no moneris tag.
You need to goto the developers page of Moneris and create a test environment first Developer Page
After creating the test store you'll need to input the store id and hp key in the values of the form you posted.

j_security_check invalid direct reference

I currently have a login form on a public, unprotected http page. Upon login I want the page to redirect to a secure https page. I am receiving this error screen when I try to login however:
I'm 90% sure my syntax is accurate. I have this exact form as a login page elsewhere on the site. This implementation is for a drop down box that enables the user to login. Here is my form for reference. Any help is appreciated, Thanks.
<div class="login-options">
<form id="login" name="j_security_form" action="<%out.write(Dropdown.getXML("https://www.xxx.com/public/j_security_check")); %>" method="post" accept-charset="UTF-8">
<strong>Account Login</strong><br>
Username:<br>
<input type="text" name="j_username"><br>
Password:<br>
<input type="password" name="j_password"><br>
<br>
<input type="submit" value="Login"><br>
<br>
New users register here<br>
Forgot password?
<input type="hidden" name="auth_mode" value="basic">
<script>
var newloc = document.location.href;
newloc =newloc.replace('index.jsp','index.jsp');
document.write('<input type="hidden" name="orig_url" value="'+newloc+'">');
</script>
</form>
</div>
Might be because you're trying to directly reference the url for j_security_check. I would try referencing a page that requires login creds, then it'll redirect to the secure page once it sees that there are adequate credentials.

"Cannot POST /dialog/authorize/decision" while implementing the OAuthorize example

I'm implementing OAuth 1.0a with the OAuthorize library. I'm following the example provided by the library.
I'm hosting my app at Heroku. Using the test client I'm able to GET a request token, and use it to /dialog/authorize:
Hi Bob Smith!
Samplr is requesting access to your account.
Do you approve?
When I press Allow, I get a Cannot POST /dialog/authorize/decision.
I've registered the endpoint in app.js:
app.post('/dialog/authorize/decision', oauth.userDecision);
Either I am missing something silly from the OAuthorize example or there is a fault in the way I'm handling the transaction.
dialog.ejs:
<form action="/dialog/authorize/decision" method="post">
<input name="transaction_id" type="hidden" value="<%= transactionID %>">
<div>
<input type="submit" value="Allow" id="allow">
<input type="submit" value="Deny" name="cancel" id="deny">
</div>
</form>
For me, the issue was that I didn't provide a proper callbackURL in server.userAuthorization callback.
see https://github.com/jaredhanson/oauthorize/blob/master/examples/express2/db/accessTokens.js#L10 and https://github.com/jaredhanson/oauthorize/blob/master/examples/express2/oauth.js#L152

Creating Paypal Donate button without access to PayPal account

I am building a website for a not for profit. I had the treasurer of the charity create a PayPal account for the charity and they have the PayPal login information.
I am trying to follow best practices for security and for this reason I, as the programmer, should not need to have the ability to login to their PayPal account. If for no other reason than if someone screws with the account or diverts money they will not put me on the list of suspects this seems to be the best way.
What I do need to do is put a donate button on their website. Normally one would simply login to PayPal and PayPal will generate the HTML code for you. If the client were proficient I could have them do this and email me the code snippet, but such is not the case.
What is the minimum amount of information I need from the treasurer, the account number? Also what is the easiest way for them to get me the information I require?
You should only need the email associated with the Paypal account receiving the donations to Create a Donate Button.
The above link will generate the following markup for you:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="josh#example.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Stackoverflow">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
The only line you will have to alter is the business input, which will be the Paypal account recipient.

Resources