In the easy_admin view, there is a fontawesome with "user unnamed".
I would like to have the name of the login user.
I configured config/packages/easy_admin.yaml like this (name is the propoerty of User that I want to display:
entities:
user:
class: App\Entity\User
display_name: true
name_property_path: 'name'
I still have "unnamed user" instead of the name of the login user. Do you have a solution? Thanks.
i faced the same issue. Please try this:
easy_admin:
user:
display_name: true
name_property_path: email
user needs to be set under easy_admin section.
Related
I have a user in database with following credentials:
{
"_id": "zTHv8yqPSm3pmi4So",
"emails": [{"address": "someemail#example.com", "verified": true}],
"services" : {
"password" : {
"bcrypt" : "$2b$10$L6HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo1IjZEx6.PBxfOeQHqS."
},
"resume" : {
"loginTokens" : [ ]
}
},
"username": "some#username",
"profile": {
"firstName": "Example",
"lastName": "User",
}
}
When I try to login user with username it says user not found:
Meteor.loginWithPassword("some#username", "123456", function(error) {
console.log(error.reason);
});
It works fine for email but not for username.
I want flexibility to login user with either of email or username
The API Meteor.loginWithPassword actually takes a "selector" as first argument:
https://docs.meteor.com/api/accounts.html#Meteor-loginWithPassword
Meteor.loginWithPassword(selector, password, [callback])
ARGUMENTS
selector Object or String
Either a string interpreted as a username or an email; or an object with a single key: email, username or id.
In your case you use the string form, and let Meteor try to guess whether it is a username or an email.
But since your username contains an "#" character, this misleads Meteor into interpreting it as an email:
https://github.com/meteor/meteor/blob/release/METEOR%401.12.1/packages/accounts-password/password_client.js#L33-L38
Meteor.loginWithPassword = (selector, password, callback) => {
if (typeof selector === 'string')
if (!selector.includes('#'))
selector = {username: selector};
else
selector = {email: selector};
That is why when you try with the email it works fine, but fails for the username containg the "#".
And the simple solution is to explicitly tell Meteor that you target the username (and not an email, despite the "#"):
Meteor.loginWithPassword({
username: "some#username"
},
"123456",
function(error) {
console.log(error.reason);
}
);
Now, if I am trying to guess further your objective, you want your user to be able to provide either their email or username as login identifier, without explicitly telling which it is? (Like a kind of "omni" login id input)
In that case, unfortunately you will have to detect yourself whether it is an email or username. If the latter really follows a pattern like "some#username", you can try to detect that the domain is incomplete (no extension).
But if any of your user did register a username which really looks like an email (e.g. "some#user.name"), then you may not be able to differentiate them.
Even worse, some user may choose a username that is exactly the email address of another user! In that case, how to tell which one is trying to log in?
IMHO, this then becomes much trouble for marginally improved UX. Either prevent usernames containing "#", i.e. enforce a rule that enables you telling the difference, or provide a way for the user to explicitly tell if it is an email or username when it is ambiguous (e.g. it can be some radios to tell which type it is; it can still contain an "auto" mode for when the login id is unambiguous).
BTW we could also imagine performing a 2 steps login attempt: first as is, then if username contains an "#", explicitly as a username as described above. But we may still fall into the above described worst case scenario...
i am working on MERN STACK app..
i want to create 3 users schema i,e Admin employee and manager pease help me out how create that 3 users schema
Actually you can do this with only 1 schema. You can define field named "role" in your user schema and everytime user login you can validate that role and check if the role is "admin" ,"employee" or "manager".
You can use this schema on your auth schema.
role: {
type: String,
default: "user",
enum: [
"admin",
"employee",
"manager"
]
}
I'm trying to share a file using the Google Drive API. I have the file ID and the email to share the file to, but I keep getting an error "The permission type field is required". I've followed all the instructions on the API guide, but nothing seemed to fix this.
I'm calling the following function, and I can't tell why this isn't working. Can someone see what I'm doing wrong please?
function shareFile(id, email) {
gdapi.permissions.create({
fileId: id,
resources: {
role: "reader",
type: "anyone",
emailAddress: email
}
});
}
Thanks!
You want to create a permission with role: "reader" and type: "anyone" using googleapis of Node.js.
You have already been able to get and put values for files in Google Drive using Drive API.
gdapi in your script can be used for creating the permission to the file in Google Drive.
If my understanding is correct, how about this answer?
Modification points:
resources is not used. Please modify resources to resource or requestBody.
If you want to use role: "reader" and type: "anyone", please remove emailAddress: email.
When above points are reflected to your script, it becomes as follows.
Modified script:
function shareFile(id, email) {
gdapi.permissions.create({
fileId: id,
resource: { // Modified
role: "reader",
type: "anyone",
// emailAddress: email // Modified
}
});
}
Note:
In this case, plese use the latest version of googleapis. In the current stage, the latest version is googleapis#47.0.0.
If you want to give role: "reader" to emailAddress: email, please modify as follows.
function shareFile(id, email) {
gdapi.permissions.create({
fileId: id,
resource: { // Modified
role: "reader",
type: "user", // Modified
emailAddress: email
}
});
}
References:
Permissions: create
googleapis for Node.js
If I misunderstood your question and this was not the direction you want, I apologize.
From what I'm seeing, I can't search for hashtags unless I have the public_content permission.
And I can't get the public_content permission unless I submit an app for review.
And I can't submit an app for review unless I have a video screencast and a very good reason as to why I need this permission. I just build websites for clients and they want to pull in posts that have one of their own hashtags. I don't see this on the list of approved application types.
Or is there another way to search for hashtags without having to go through all this?
while requesting code you may pass scope as public_content
https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=redirect_uri=REDIRECT-URI&response_type=code&scope=public_content
I am working with this right now. In your case, if you are only searching by one hashtag at each time you better use instafeed.js
http://instafeedjs.com
I have done this task with this library like this.
var feed = new Instafeed({
get: 'tagged',
tagName: audi',
clientId: 'XXXXX',
accessToken: 'XXXXX',
template: '<li><img src="{{image}}" /></li>'
});
feed.run();
var feed = new Instafeed({
get: 'tagged',
tagName: 'ferrari',
clientId: 'XXXXX',
accessToken: 'XXXXX',
template: '<li><img src="{{image}}" /></li>'
});
feed.run();
var feed = new Instafeed({
get: 'tagged',
tagName: 'BMW',
clientId: 'XXXXX',
accessToken: 'XXXXX',
template: '<li><img src="{{image}}" /></li>'
});
feed.run();
If anyone know how to search by 2 or more hashtags at each time please contact me.
Hope it helps you!
we are using both windows authentication and forms based authentication in a claims aware SharePoint WebApplication. The custom MembershipProvider (datasource: Novell eDirectory) works just fine but I'm uncertain about a few things.
The cn property of each user record is a unique identifier (hexadecimal value).
Users are logging in using their email addresses (and password) though. We don't want to make the unique identifier visible anywhere.
GetUser(string username, bool userIsOnline)
FindUsersByEmail(...) and
FindUsersByName(...)
return MembershipUser(s) which are constructed this way:
CustomMembershipUser membershipUser = new CustomMembershipUser(
providerName: Name, // the membership provider's name
userName: providerUserKey, *// the "cn" name*
providerUserKey: providerUserKey, *// again the "cn" name*
email: email, // the email used to log in
passwordQuestion: null,
comment: null,
isApproved: true,
isLockedOut: false,
creationDate: DateTime.MinValue,
lastLoginDate: DateTime.MinValue,
lastActivityDate: DateTime.MinValue,
lastPasswordChangedDate: DateTime.MinValue,
lastLockedOutDate: DateTime.MinValue,
firstName: givenName,
lastName: surName);
The last two parameters are "Custom-"MembershipUser parameters. My ultimate goal is to display users in an Windows-Integrated-Authentication-style "LastName, FirstName".
Right now upon entering my email address the people picker resolves my email address to a "cn" name which is something like XYZ12345. Instead I want to display "LastName, FirstName" throughout SharePoint. The information is present in the datasource (eDirectory) and I can enrich my CustomMembershipUser with this information but of course neither the PeoplePicker nor anything else in SharePoint will be aware of my custom MembershipUser.
Is there anything claims related I should be aware of?