How to modify laravel 5.6 login behaviour? How to add more fields for logging along with email and password? - authentication

Laravel has 2 fields in its auth to help user login i.e email and password. I have added another field(hidden field) in the login blade to pass a random number along with a password and email.
In my eloquentuserprovider.php i am grabbing $credentials[‘password’] and $credentials[‘email’] like this but when I write $credentials[‘hidden’] I get an error saying ‘undefined index hidden’.
So my question is how should I add other fields along with email and password to validate the user
I am writing all my validation logic in eloquentuserprovider.php

Related

Testing in Laravel 5.5

I want to test the user login without using dusk.
My problem is that I want to test the html form with the email and password fields, then complete those fields and if the login was correct, show the home route for example.
In previous versions we made this:
$this->type('email', 'example#gmail.com);
$this->type('password', '123456');
Now, I dont know how to do it.
$this->actingAs($user); //USUARIO CREADO ANTERIORMENTE
$response = $this->get(route('home'));
$response->assertStatus(200)
$response->assertViewIs('home');
The check I can do is that a logged-in user can go to the home path, but not when filling in the forms fields.

How to get user information from hippo via HST

I'm evaluating the hippo cms,
after add hst-security as a dependence ,so public site need login, but how can I fetch the login user's detail information like email and something else.
I used HstRequest.getUserPrincipal ,but only get the username.
and tried to write a query "SELECT_USER_QUERY = "SELECT * FROM hipposys:user"
but only get a user 'liveuser', after login with admin.
so , Anyone can help me ,how can I get the detail info?
You can do this:
final User user = JcrSessionUtils.getHippoSession(request.getRequestContext().getSession()).getUser();
user.getEmail();
user.getLastLogin()

MVC user's full name in Url, how to handle duplicates

I want to setup the following url in my MVC4 website, using the user's full name in the url:
http://www.myapp.com/profile/steve-jones
I have setup the following route in Global.asax:
routeCollection.MapRoute(
"profile", "profile/{userName}",
new { controller = "myController", action = "profile", userName = string.Empty
});
And I can take the parameter 'steve-jones' and match it to a user with matching name. My only problem though is, what if there is more than one 'Steve Jones', how can I handle this?
Does anyone know of a workaround/solution to this so that I can use a user's full name as part of the url and still be able to retrieve the correct user in the controller method?
Am I forced into including the user's id with the url (something that I do not want to appear)?
The usual way of handling this is by appending a number when creating the profiles. So if "steve-jones" is already a name in the database, then make the user's display name "steve-jones2". You basically have to insist that all profile urls are unique, which includes updating any existing database and account creation code.
Alternatively (and/or additionally), if two same names are found then have the script reroute to a disambiguation page where the user is presented with links and snippet of profile info of the many existing Steve Joneseses so they can go to the full correct profile.
Another way of handling it is by giving all user profiles an additional numeric code on the end. At my university all logins are based on name, so they give everyone pseudo-random 3-digit extensions so that they are safe as long as they don't get 1000 people with the exact same names :)
Some people might be happier being steve-jones-342 if there is no steve-jones or steve-jones1, if you're concerned.

Parse.com - using only emails for user login

With the default login and signup views provided by Parse, can I avoid asking the users to choose a username and just use email as user identifier?
[By Parse support team]
You can change the Placeholder label on the username field to say "Email Address", and you can hide the normal Email address field on the Login View Controller.
signUpController.signUpView.emailAsUsername = true

How to change registration requirement for user ID in chat function

Hi when I run the sample chat function provided by quickblox, it contains several built-in limitation for username registration, for example, I need to have a certain number of characters or type of characters in order to register. I'm wondering which files contain those registration and display of error messages (I only found a class called "errors" in SignUpViewController ) and how do I change those limitations?
There are 2 ways:
Sign Up & then Sign In with email
Sign Up & then Sign In with login - Login field should contain alphanumeric and punctuation characters only
Is it OK? Or you have problem with other User's field?