ResetPassword function for CodeFirstMembership Provider - asp.net-mvc-3

Does anyone know how to implement ResetPassword function for custom Membership Provider in MVC3 app?
Notice that I'm using CodeFirstMembershipProvider. It seems to doesn't have such an implementation of ResetPassword function.

Related

It is mandatory to use the login component in order to use the other components

I'm developing an application in React, I'm using MSAL for the application login and once the user is authenticated I want to use the card component of a person but I can't make it work.
I tell you what I have implemented in case I forgot some steps. I have added the following tag in the component itself:
<mgt-msal-provider client-id={process.env.REACT_APP_MSALCLIENTID}></mgt-msal-provider>
where that client I'm using on MSal to authenticate the user. I have also tried to define it in the builder itself:
Providers.globalProvider = new MsalProvider({clientId:process.env.REACT_APP_MSALCLIENTID});
Now if I put the login tag on the card component and click it, it works perfectly.
Is it possible to use the same msal of my application with the graph toolkit msal provider?
The toolkit components need to have a way to call the graph, and that's accomplished through a provider. If you are already authenticated with your own msal, you don't need to use the MsalProvider and you can create a SimpleProvider or create your own provider. The provider has two main purposes - to notify the component when the authenticate state changes (signed in/signed out), and to get accessToken for calling the graph with a provided scope. For example, at a minimum, you can do this:
Providers.globalProvider = new SimpleProvider((scopes) => {
//return accessToken for scopes using your msal instance
});
// when the user signs in, set the provider state to signedIn
// this will notify all components that the user is signed in
// and they can call the graph
Providers.globalProvider.setState(ProviderState.SignedIn);

Access ForgotPasswordController when authorized

I am not very good at English so not sure if I can explain my status correctly.
Currently, I am building admin panel which allow users to reset their password. So in the admin panel, I select user and click 'reset password' button. Then, resetPassword notification email will be sent to specific users(by email).
I am trying to do this with ForgorPasswordController's sendResetLinkEmail function but it seems I can't access their once authorized.
How can I solve this problem?
Thanks
You don't (and probably shouldn't) use that controller.
It will be easier to create new controller for your admin panel page and use the built in helper:
https://laravel.com/api/5.8/Illuminate/Auth/Passwords/PasswordBroker.html#method_sendResetLink
That should be available through Password facade
use use Illuminate\Support\Facades\Password;
(...)
Password::sendResetLink($emailAddress, function (Message $message) {
$message->subject('Password Reset');
});

Custom logic on social Login

Is there any way to override the default social login providers and add some additonal functionality?
I would like to create an account directly as soon as the first login takes place.
Also I would like to know where the auth controller is implemented. Could not find it within https://github.com/Azure/azure-mobile-apps-net-server repository.
Where are these login/auth controllers are coming from?
The authentication providers are in a module sitting in front of your service, so the authentication already happens before you get there. You cannot add functionality to this module.
What you can do is call a custom API on login. Normally, you would use the client.loginAsync() or client.loginWithProvider() methods (depending on the SDK in use). Immediately after the login routine returns, call the client.invokeApi() (or the Async version) to call a custom API to do whatever you need to.

Custom registration with Laravel 5.1

I am new to Laravel. I have two different user types: teachers and students. Teachers register accounts in registration form in website but student registration is provided by a windows application. So I must provide an API to this application. Default Laravel auth is enough for teacher registration but can I use same AuthController for API registration? I don't need a view or redirect to website.
You have two options actually
create a method on your auth controller and apply a middleware to the controller method which would only be available for api calls so a student doesnt create himself/herself as a teacher, you can read more about same here http://laravel.com/docs/5.0/middleware
which I would suggest is to create another auth controller for your api calls that only serves for creating student accounts that way its clean, easier to manage and concept of separation of concerns is put into practice.

How to use [Authorize] and [FacebookAuthorize] in mvc3 web app using mixed membership

We are using our first website that will give the users the choice of either using our standard .net membership provider or facebook using the facebook c# sdk (awesome sdk by the way!).
We have handled most of it but need to restrict access to certain areas based on the user being logged in or not. In the past with pure .net membership we used the [Authorize] attribute on the method, however if the user is logged in using facebook then this is false.
I know I can try to roll our own dataannotation extension. Or I could just manually try one or the other. I know there is also the FacebookAuthorization annotation. I would ideally like to use these annotations (as both would go to the same login page if the user is not logged in).
Does anyone have a good example of a site using mixed membership using some dataannotation? Or a dataannotation extension?
Thanks in advance
Call the standard FomsAuthentication.SetAuthCookie method upon completing the Facebook OAuth flow. The Authorize attribute should then work properly.
We have used a global filter attribute. We've created that one our self. If somebody has a better idea, I'm open for suggestions!

Resources