I want to make a section of my meteor error string as a link.
if (customer.password) {
throw new Meteor.Error('server-error_email-in-use', 'Email already in use with a non-guest account, please log in to complete your order');
}
how can i make "log in" a hyperlink to login page?
Related
'When I try to assert some web elements,if assertion fails cucumber stops execution with error
AssertionError:'567'='abc'
Feature file:
Scenario: Validation of button
Given I hit login page
When login page gets loaded
Then validate text on button
Scenario:Login to the page
Given user provide login details
When clicks on login button
Then sign in the user
Cucumber stops abruptly and result of passed steps is not shown.
If assertion fails,I want to go cucumber to execute next steps .please help and thanks.'
Update with step example:
this.Then(/^Validate text on button$/, function() {
var textonbutton = browser.driver.findElement(by.xpath("it's xpath"));
textonbutton.getText('innerText').then(function(innerText) {
return assert.equal(innerText, "567");
});
});
I am quite new to MEAN and I am learning a lot. At the moment I am trying to show an error message on my page when an user is not allowed into the website. The page contains a button which redirects you to the steam login. After you login the steam API sends your steamid which I will then check in the mongodb database:
app.get('/auth/steam/return',
passport.authenticate('steam', { failureRedirect: '/' }),https://stackoverflow.com/users/5333805/luud-van-keulen
function(req, res) {
UserModel.findOne({ steamid : req.user.id }, function (err, user) {
if(!user) {
console.log('does not exist');
//Probably have to set the error message here
} else {
req.session.userid = req.user.id; //Setting the session
}
});
res.redirect('/');
});
The only thing that I can't get working is how to show a message when the user is not allowed (he is not in the database). I want to use AngularJS for the HTML (so no Jade).
I do know that I have to set a variable somewhere in the response header and then with AngularJS I need to check if this variable exists or not. When It exist it should show the div which contains the error message.
The problem is that I can't use res.render because I need to redirect.
So in the block where user is not found, you should have something like:
res.status(401).send("Login failed.");
And then on the client side you can check the response status and display the mesage.
Edit: if you need help on the client side as well, please provide your client code.
I ended up using express-flash.
I created a new login page wherein only those account that can be found on the database could login to our home page...
What i plan is when i click the login button, the user will be redirected to the home page.. I do this by creating a new branch and then in the conditions tab, i put the code for checking the existence of the account that has been inputted in the text field.. but what happened is it just show an error message 'invalid login credentials' always...
i'm sure that the code in conditions that we put is correct,,,, it could detect that the username and password is wrong because it shows the error message i created that returns when this happend...
here is the code in my conditions.. check_login is a procedure that returns true if the account is found in the database...
if CHECK_LOGIN(:P111_USERNAME, :P111_PASSWORD) then return true;
else
return false;
end if;
could anyone help us with this one? Thanks in advance
You need a custom authentication scheme to solve this, not conditional branching etc. You also do not need to build a new login page. The standard login page will hold all you need, and will simply use the current active authentication scheme. Authentication schemes can be found under the Shared Components.
You can find some oracle documentation here. There are also plenty of blog posts to be found when you search for "oracle apex custom authentication" on google!
Also, when creating a custom scheme, you can click the item labels for help. For example, this is in the authentication function name help:
Specify the name of the function that will verify the user's username
and password, after they were entered on a login page. If you enter
nothing, you allow any username/password to succeed. The function
itself can be defined in the authentication's 'PL/SQL Code' textarea,
within a package or as a stored function.
This function must return a boolean to the login procedure that calls
it. It has 2 input parameters 'p_username' and 'p_password' that can
be used to access the values an end user entered on the login page.
For example, enter the following code in the 'PL/SQL Code' textarea
function my_authentication (
p_username in varchar2,
p_password in varchar2 )
return boolean
is
l_user my_users.user_name%type := upper(p_username);
l_pwd my_users.password%type;
l_id my_users.id%type;
begin
select id , password
into l_id, l_pwd
from my_users
where user_name = l_user;
return l_pwd = rawtohex(sys.dbms_crypto.hash (
sys.utl_raw.cast_to_raw(p_password||l_id||l_user),
sys.dbms_crypto.hash_md5 ));
exception
when NO_DATA_FOUND then return false;
end;
and
my_authentication
as 'Authentication Function'.
Note that your function requires parameters p_username and p_password!
You can leave the other fields blank, they will be handled by default functions!
I've built a Silverlight website where users can create an account and login. Right now, users just create an account through a form and can directly login. I want to incorporate a email verification feature, where the user will receive an email with a verification URL and only then can he login. I also wish to incorporate a forgot password feature that sends an email to the users registered email address to recover password.
How can I do this in silverlight. I'm using Windows SQL Azure as the back-end database. Will I have to create a separate Application for creating user accounts and recovering passwords?
Hope this helps you out on part A of your problem.
I noticed the post might throw you off a bit, so I decided to write a method that will do this for you in the quickest amount of time.
public bool Send(string fromEmail, string toEmail, string subject, string body)
{
try
{
MailMessage message = new MailMessage();
message.From = new MailAddress(fromEmail);
message.To.Add(new MailAddress(toEmail));
message.Subject = subject;
message.Body = body;
message.IsBodyHtml = false;
SmtpClient smtp = new SmtpClient();
smtp.EnableSsl = true;
smtp.Send(message);
return true;
}
catch (Exception ex)
{
return false;
}
}
Essentially, once they create their account you would want to call this filling out all variables. Make sure in your body of text you have a link that sends them to a page where they can submit "activate" their account.
This will essentially be a bit value in the database that is set to false by default and won't be set to true until they click on the "submit" or "activate" button from the link that would be in the body of text.
For password recovery you would do the same. Except instead of sending them to a page to activate their account you'd send them to a page where they could just re-create their password. Since the database doesn't care if the password is old or new you could just send them to a page where they create a new password. You wouldn't even need to create a temp password for them (Unless you wanted to for experience and for a extra caution).
Happy Coding! ;)
I have a link on the main page that is only accessible if they are logged in. However, if this link is clicked, I want to show a custom error message on the login page (a custom 'Message.auth').
i.e. I want (pseudo code)
if (referer == '/users/reserve'){
Message.auth = 'Please log in to reserve tickets';
}
else {
Message.auth = 'Please log in to access that page';
}
Where would I put this bit of code?
Provided you have auth flash messages being output in the login view, this should work:
// login action of users_controller.ctp
if ($this->Session->check('Auth.redirect')
&& $this->Session->read('Auth.redirect') == '/users/reserve') {
$this->Session->write('Message.auth', 'Please log in to reserve tickets');
}
to get referer you can call $this->referer() to get the referring URL then pass that value to your view.
see: referer