FlowRouter for signup and sign in


#1

I had a hard time to make a custom register and login functionality using flow router. I have two tamplates LogIn and Register. The landing page of the application will have only login or register. The register form has a tap to change either to sign in or to register. Afte registration or sign in a use will land on his page. The problem is only the routing part. Who could help me out. I have already exhaustively tried by myself. In addition to that, uploading image to my project is a hassel. Many of the example I tried they use s3 but I would prefer local storage. Thanks


#2

Sure thing, just to clarify. You are having a problem redirecting to a specific page after login and/or register? If you have written custom login fields you do something like this.

HTML

<form id="your-login-form">
	<input type="text" name="username">
	<input type="password" name="password">
        <input type="submit" value="login">
</form>

JS

'submit #your-login-form'(event){
	event.preventDefault()
        Meteor.loginWithPassword(event.target.username.value, event.target.password.value, () =>{
        	FlowRouter.go('/your_route')
        })
}

After we figure this out, I’ll help you with your image upload problem, but one question. Does it have to be Amazon s3? or would another service be ok? Because I highly recommend Cloudinary as an image service for its ability to manipulate images as you request them via size or filters.


#3

My problem is routing. I have problem of directing . For storage, I don’t appreciate, S3. If you read it once the question, it might be clear.Thanks


#4

Sure so you just need to get to routes/declare them?

FlowRouter.route('/login', { <- the url
    name: 'login', <- The name 
    action() {
        BlazeLayout.render('login_view'); <!- name of your template (example: <template name="login_view">)
    }
});

#5

Yesterday, I was on mobile device. I like to show you how my login and register from look. I have tried in many possible ways of routing using flow router and I couldn’t succed. Even I have tried your suggestion.


#6

Are you using Blaze? If so on top of flow router, do you happen to have this package installed https://github.com/kadirahq/blaze-layout?


#7

yes, I have installed all the required package
kadira:flow-router
kadira:blaze-layout

How about if you suggest me a good article or tutorial about image uploading on a metoer project.