https://embed.plnkr.co/oCd2WrzJjFtvgsGdHrdV3b/
Hello , I created Login page and Register page. But I need to add an additional functionality of confirm password. I am pretty confused in handling this with my controllers.
can anyone help me in validation part.
When I give Ng-match or directives , it is not compatible with my existing controller. Either it states Registration successful in case of wrong password or else my view is just empty in browser.
Use following ng-match directive
http://ngmodules.org/modules/ng-match
plnkr.co/edit/LRXKpql1AxmGNcTWifGS?p=preview
I solved the issue you faced with confirmPassword. I'm just
saying where you made the mistake
1)password name in ng-modal and name in "required data-password-verify" at confirm password should match when you compare two passwords.
2)Please have a look at console first,then you understand where you did a mistake.Console clearly saying two issues i.e app is not defined at passwordVerify.js and User service not defined.
3)I changed passwordVerfiy directive to register controller and I commented userservice wherever i find.Because I have not seen anywhere you are using Userservice class.Both the files(user.service and user.service,localstorage) are empty
I would be more happy if my code resolve your problem.
Thank you
Related
I am currently working on an Angular project for school for which I need to change the current webpage if there's been a successful login.
The login part finally is working, but now I'm a bit lost as to how I'm supposed to redirect the user to their page if they've successfully logged in.
My login function detects a success message and uses that as an argument for the function from which I want to redirect the user (The error message redirection I'll get to later):
redirect(message) {
if (message == "Logged in."){
console.log("success")
$window.location.href = '/user.html';
}
if (message == "Password incorrect, please try again"){
}
if (message == "No user registered with this e-mail"){
}
}
This is what I currently have, inspired by some other answers on here. It's not working because the $window variable is undefined, I have tried injecting it into the function but that didn't work either. All the answers I've seen somehow implemented this through a controller, but I finally have the login working without using controllers so I'd rather solve it this way (if that's possible) than to now implement my whole program differently.
I am very new to angular if that wasn't clear already so any help is much appreciated.
You can use window.location or window.location.href.
Think of $window as the 'angularJS version" of the global window object.
You don't need to use it, but it makes mocking and unit testing easier.
I am new to Appcues development and referring to the example given in this page for AngularJS.
Appcues Example for AngularJS
I noticed that the AuthService is being used in the controller code but the AuthService is not provided anywhere. Due to this, the code is unable to infer the AuthService and it is not possible to load the page.
Could anyone suggest how AuthService should be inferred so that the page can be rendered?
Please let me know if I need to provide any specific details.
Thanks,
Ramesh, INDIA
Your syntax for the controller is wrong, it should be, Remove the extra ) after the controller name
.controller('LoginController',function($scope,$rootScope,AUTH_EVENTS,AuthService){
}
I am developing an angjs application.
Used angjs 1.6.
Following is my code to create a cookie
$cookies.put('globals', $rootScope.globals);
When i open a new tab, I dont find this cookie variable "globals".
How to share cookies across multiple tabs?
cookies are document specific. So, you are not getting in other tab. Please go for ngStorage or use localStorage
and one more thing is even you want to store non-prmitive data(object, array etc) in cookies/storage, you must stringfy before pushing and should be parsed after getting.
eg: $cookies.put('globals', JSON.stringify({name: 'My_name'}));
var myName = JSON.parse($cookies.get('globals'));
Check if this helps you out:
$cookies.put('globals', $rootScope.globals, {domain: 'yourdomainhere'});
As my question asks, I want to know if that is possible. Why I want this? I am required to keep the link when the request fails so I use states in my bootstrap template instead of templates for the error pages. Now I need to catch everything that isn't registered and I need to tell my main controller to change the state if the route is not found. I checked the documentation, of course but it hasn't enlightened me so please help me out here if you can.
$httpProvider.otherwise(function () {
// code here
});
Is something like this possible?
I have a CakePHP app that seems to be terminating my session on one specific action. I have a page which, when a link is clicked, launches a Fancybox overlay of the iframe type. In that overlay, the user fills out and submits a form. The form is submitted properly, does its work (including sending an email), loads the success view and lets me close the overlay, but as soon as I try to get to any other page, I'm sent to the login screen to reauthenticate.
The value of my Security.level config setting is medium and my Session.timeout is 120, so that shouldn't be the problem. Anyone have any idea what could be creating this?
Thanks.
is it possible that your ajax calls and redirects are not going to the same place, eg www.site.com and site.com? I have had that before and also kept getting logged out.
So this wasn't fun to track down, but it was me being an idiot. Buried in the code was some early-stage code to refresh user data in the authenticated session that wasn't doing what it should have been doing. It was attempting to update the entire Auth.User object directly (e.g. $this->Session->write( 'Auth', $user )) instead of calling the login method.
Once I changed the Session::write() code to $this->Auth->login( $user ), everything lined up nicely. A nice bit of reference material on this subject at http://milesj.me/blog/read/31/Refreshing-The-Auths-Session.